Security fix: Incorrect permission assignment for critical resource

This commit is contained in:
nemunaire 2023-07-14 16:49:57 +02:00
commit f097c029f3
10 changed files with 17 additions and 17 deletions

View file

@ -212,11 +212,11 @@ func main() {
}
// Creating minimal directories structure
os.MkdirAll(fic.FilesDir, 0777)
os.MkdirAll(fic.FilesDir, 0751)
os.MkdirAll(pki.PKIDir, 0711)
os.MkdirAll(api.TeamsDir, 0777)
os.MkdirAll(api.DashboardDir, 0777)
os.MkdirAll(settings.SettingsDir, 0777)
os.MkdirAll(api.TeamsDir, 0751)
os.MkdirAll(api.DashboardDir, 0751)
os.MkdirAll(settings.SettingsDir, 0751)
// Load rules plugins
for _, p := range checkplugins {

View file

@ -47,8 +47,8 @@ func GenerateCA(notBefore time.Time, notAfter time.Time) error {
}
// Ensure directories exists
os.Mkdir(PKIDir, 0777)
os.Mkdir(path.Join(PKIDir, "shared"), 0777)
os.Mkdir(PKIDir, 0751)
os.Mkdir(path.Join(PKIDir, "shared"), 0751)
pub, priv, err := GeneratePrivKey()
if err != nil {

View file

@ -189,7 +189,7 @@ func getDestinationFilePath(URI string) string {
}
func importFile(i Importer, URI string, dest string) error {
if err := os.MkdirAll(path.Dir(dest), 0755); err != nil {
if err := os.MkdirAll(path.Dir(dest), 0751); err != nil {
return err
}

View file

@ -64,7 +64,7 @@ func (i LocalImporter) importFile(URI string, next func(string, string) (interfa
if i.Symlink {
dest := getDestinationFilePath(URI)
if err := os.MkdirAll(path.Dir(dest), 0755); err != nil {
if err := os.MkdirAll(path.Dir(dest), 0751); err != nil {
return nil, err
}