mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-24 05:59:55 +08:00
Config file is not executable, and must not be world accessible
It contains the private key.
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user