Skip to content

Commit 91e981f

Browse files
committed
fix(cmd): relax file perms for Falco driver config override
Falco config files are not supposed to contain sensitive information, so read permissions are given to all users. With this fix, the permissions of the config file for the driver engine override will be aligned to other Falco configs files under `/etc/falco`. Signed-off-by: Leonardo Grasso <[email protected]>
1 parent 7e06ca9 commit 91e981f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmd/driver/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright (C) 2023 The Falco Authors
2+
// Copyright (C) 2024 The Falco Authors
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -238,7 +238,7 @@ func overwriteDriverType(configDir string, driverType drivertype.DriverType) err
238238
_, err := os.Stat(configDir)
239239
if os.IsNotExist(err) {
240240
// Create it.
241-
if err := os.MkdirAll(configDir, 0o750); err != nil {
241+
if err := os.MkdirAll(configDir, 0o755); err != nil { // #nosec G301 //we want 755 permissions
242242
return fmt.Errorf("unable to create directory %s: %w", configDir, err)
243243
}
244244
} else if err != nil && !os.IsNotExist(err) {
@@ -252,7 +252,7 @@ func overwriteDriverType(configDir string, driverType drivertype.DriverType) err
252252
}
253253

254254
// Write the engine configuration to a specialized config file.
255-
if err := os.WriteFile(filepath.Join(configDir, falcoDriverConfigFile), engineKind, 0o600); err != nil {
255+
if err := os.WriteFile(filepath.Join(configDir, falcoDriverConfigFile), engineKind, 0o644); err != nil { // #nosec G306 //we want 755 permissions
256256
return fmt.Errorf("unable to persist engine kind to filesystem: %w", err)
257257
}
258258

0 commit comments

Comments
 (0)