Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
(MAINT) Change Mkdir(All)? perms from 750 -> 0750
Browse files Browse the repository at this point in the history
Prior to this commit, when running linting checks locally, you
would encounter the following error:

```
SA9002: file mode '750' evaluates to 01356; did you mean '0750'
```

This commit fixes the perm value to avoid this error.

Also changes a `0755` perm setting to a more secure `0750` in
`tar_test.go`
  • Loading branch information
sanfrancrisko committed Aug 24, 2021
1 parent 5cfece9 commit 366cfbb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/pkg/pct/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestBuild(t *testing.T) {
afs := &afero.Afero{Fs: fs}

for _, path := range tt.mockDirs {
afs.Mkdir(path, 750) //nolint:gosec,errcheck // this result is not used in a secure application
afs.Mkdir(path, 0750) //nolint:gosec,errcheck // this result is not used in a secure application
}

for _, path := range tt.mockFiles {
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/pct/pct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Summary: {{.example_replace.summary}}`,
// Create the template
templateDir := filepath.Join(tt.args.info.TemplateCache, tt.args.info.SelectedTemplate)
contentDir := filepath.Join(templateDir, "content")
afs.MkdirAll(contentDir, 750) //nolint:errcheck
afs.MkdirAll(contentDir, 0750) //nolint:errcheck
// Create template config
config, _ := afs.Create(filepath.Join(templateDir, "pct-config.yml"))
config.Write([]byte(tt.args.templateConfig)) //nolint:errcheck
Expand Down Expand Up @@ -313,7 +313,7 @@ template:
// Create the template
templateDir := filepath.Join(tt.args.templateCache, tt.args.selectedTemplate)
contentDir := filepath.Join(templateDir, "content")
afs.MkdirAll(contentDir, 750) //nolint:errcheck
afs.MkdirAll(contentDir, 0750) //nolint:errcheck
// Create template config
config, _ := afs.Create(filepath.Join(templateDir, "pct-config.yml"))
config.Write([]byte(tt.args.templateConfig)) //nolint:errcheck
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/tar/tar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestTar(t *testing.T) {

fs := afero.NewMemMapFs()
afs := &afero.Afero{Fs: fs}
afs.MkdirAll(tt.args.source, 755) //nolint:errcheck
afs.MkdirAll(tt.args.source, 0750) //nolint:errcheck

tar := &tar.Tar{AFS: afs}
tarFilePath, err := tar.Tar(tt.args.source, tt.args.target)
Expand Down

0 comments on commit 366cfbb

Please sign in to comment.