Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict safe_guard file permissions #607

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/initializer/validator/datavalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (d *DataValidator) sanityCheck(failBelowRevision int64) (DataDirStatus, err
if _, err := os.Stat(path); err != nil {
if errors.Is(err, os.ErrNotExist) {
data := []byte(namespace)
err := os.WriteFile(path, data, 0644)
err := os.WriteFile(path, data, 0600)
if err != nil {
d.Logger.Fatalf("can't create `safe_guard` file because : %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/initializer/validator/datavalidator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var _ = Describe("Running Datavalidator", func() {
// change the content of safe_guard file to indicate wrong volume mount
path := outputDir + "/" + "safe_guard"
data := []byte("abcd")
err = os.WriteFile(path, data, 0644)
err = os.WriteFile(path, data, 0600)
Expect(err).ShouldNot(HaveOccurred())

dataDirStatus, err := validator.Validate(Sanity, 0)
Expand Down