Set hardcoded file permissions to 0o600 (#153)

This commit is contained in:
Moritz Eckert 2022-05-17 13:10:39 +02:00 committed by GitHub
parent 8e0f9491af
commit 772aa66fb4

View File

@ -47,7 +47,7 @@ func NewHandler(fs afero.Fs) Handler {
// Read reads the file given name and returns the bytes read. // Read reads the file given name and returns the bytes read.
func (h *Handler) Read(name string) ([]byte, error) { func (h *Handler) Read(name string) ([]byte, error) {
file, err := h.fs.OpenFile(name, os.O_RDONLY, 0o644) file, err := h.fs.OpenFile(name, os.O_RDONLY, 0o600)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -66,7 +66,7 @@ func (h *Handler) Write(name string, data []byte, options Option) error {
if options.Has(OptOverwrite) { if options.Has(OptOverwrite) {
flags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC flags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC
} }
file, err := h.fs.OpenFile(name, flags, 0o644) file, err := h.fs.OpenFile(name, flags, 0o600)
if err != nil { if err != nil {
return err return err
} }