提交 ce439133 作者: Juan Batiz-Benet

Merge pull request #910 from tv42/config-mode

Config file is not executable, and must not be world accessible
......@@ -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
}
......
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)
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论