-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: updated config file permission requirements for windows (#9732)
* fix: reduced config file permission restriction on windows Signed-off-by: Soumya Ghosh Dastidar <[email protected]> * fix: updated localconfig tests to check error Signed-off-by: Soumya Ghosh Dastidar <[email protected]>
- Loading branch information
Showing
4 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build !windows | ||
|
||
package localconfig | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func getFilePermission(fi os.FileInfo) error { | ||
if fi.Mode().Perm() == 0600 || fi.Mode().Perm() == 0400 { | ||
return nil | ||
} | ||
return fmt.Errorf("config file has incorrect permission flags:%s."+ | ||
"change the file permission either to 0400 or 0600.", fi.Mode().Perm().String()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build windows | ||
|
||
package localconfig | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func getFilePermission(fi os.FileInfo) error { | ||
if fi.Mode().Perm() == 0666 || fi.Mode().Perm() == 0444 { | ||
return nil | ||
} | ||
return fmt.Errorf("config file has incorrect permission flags:%s."+ | ||
"change the file permission either to 0444 or 0666.", fi.Mode().Perm().String()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters