1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-23 21:47:52 +08:00

Config file is not executable, and must not be world accessible

It contains the private key.
This commit is contained in:
Tommi Virtanen
2015-03-05 14:45:19 -08:00
parent e0cf24bfeb
commit 5baf3c7fc1
2 changed files with 9 additions and 1 deletions

View File

@ -35,7 +35,7 @@ func WriteConfigFile(filename string, cfg interface{}) error {
return err
}
f, err := atomicfile.New(filename, 0775)
f, err := atomicfile.New(filename, 0660)
if err != nil {
return err
}

View File

@ -1,6 +1,7 @@
package fsrepo
import (
"os"
"testing"
config "github.com/jbenet/go-ipfs/repo/config"
@ -23,4 +24,11 @@ func TestConfig(t *testing.T) {
if cfgWritten.Datastore.Path != cfgRead.Datastore.Path {
t.Fail()
}
st, err := os.Stat(filename)
if err != nil {
t.Fatalf("cannot stat config file: %v", err)
}
if g := st.Mode().Perm(); g&0117 != 0 {
t.Errorf("config file should not be executable or accessible to world: %v", g)
}
}