diff --git a/pkg/chrootarchive/archive_test.go b/pkg/chrootarchive/archive_test.go index 755e7daad9..4e22ac6fd9 100644 --- a/pkg/chrootarchive/archive_test.go +++ b/pkg/chrootarchive/archive_test.go @@ -47,10 +47,10 @@ func TestChrootTarUntar(t *testing.T) { if err := os.Mkdir(src, 0o700); err != nil { t.Fatal(err) } - if err := os.WriteFile(filepath.Join(src, "toto"), []byte("hello toto"), 0644); err != nil { + if err := os.WriteFile(filepath.Join(src, "toto"), []byte("hello toto"), 0o644); err != nil { t.Fatal(err) } - if err := os.WriteFile(filepath.Join(src, "lolo"), []byte("hello lolo"), 0644); err != nil { + if err := os.WriteFile(filepath.Join(src, "lolo"), []byte("hello lolo"), 0o644); err != nil { t.Fatal(err) } stream, err := archive.Tar(src, archive.Uncompressed) @@ -75,7 +75,7 @@ func TestChrootUntarWithHugeExcludesList(t *testing.T) { if err := os.Mkdir(src, 0o700); err != nil { t.Fatal(err) } - if err := os.WriteFile(filepath.Join(src, "toto"), []byte("hello toto"), 0644); err != nil { + if err := os.WriteFile(filepath.Join(src, "toto"), []byte("hello toto"), 0o644); err != nil { t.Fatal(err) } stream, err := archive.Tar(src, archive.Uncompressed) @@ -110,7 +110,7 @@ func prepareSourceDirectory(numberOfFiles int, targetPath string, makeSymLinks b fileData := []byte("fooo") for n := 0; n < numberOfFiles; n++ { fileName := fmt.Sprintf("file-%d", n) - if err := os.WriteFile(filepath.Join(targetPath, fileName), fileData, 0700); err != nil { + if err := os.WriteFile(filepath.Join(targetPath, fileName), fileData, 0o700); err != nil { return 0, err } if makeSymLinks { @@ -288,7 +288,7 @@ func TestChrootUntarPath(t *testing.T) { buf := new(bytes.Buffer) buf.ReadFrom(stream) tarfile := filepath.Join(tmpdir, "src.tar") - if err := os.WriteFile(tarfile, buf.Bytes(), 0644); err != nil { + if err := os.WriteFile(tarfile, buf.Bytes(), 0o644); err != nil { t.Fatal(err) } if err := UntarPath(tarfile, dest); err != nil { @@ -355,7 +355,7 @@ func TestChrootApplyDotDotFile(t *testing.T) { if err := os.Mkdir(src, 0o700); err != nil { t.Fatal(err) } - if err := os.WriteFile(filepath.Join(src, "..gitme"), []byte(""), 0644); err != nil { + if err := os.WriteFile(filepath.Join(src, "..gitme"), []byte(""), 0o644); err != nil { t.Fatal(err) } stream, err := archive.Tar(src, archive.Uncompressed) diff --git a/pkg/chrootarchive/archive_unix_test.go b/pkg/chrootarchive/archive_unix_test.go index 3cac35384c..6a3ca974fc 100644 --- a/pkg/chrootarchive/archive_unix_test.go +++ b/pkg/chrootarchive/archive_unix_test.go @@ -34,7 +34,7 @@ func TestUntarWithMaliciousSymlinks(t *testing.T) { // Add a file into a directory above root // Ensure that we can't access this file while tarring. - err = os.WriteFile(filepath.Join(dir, "host-file"), []byte("I am a host file"), 0644) + err = os.WriteFile(filepath.Join(dir, "host-file"), []byte("I am a host file"), 0o644) assert.NilError(t, err) // Create some data which which will be copied into the "container" root into @@ -44,7 +44,7 @@ func TestUntarWithMaliciousSymlinks(t *testing.T) { data := filepath.Join(dir, "data") err = os.Mkdir(data, 0o755) assert.NilError(t, err) - err = os.WriteFile(filepath.Join(data, "local-file"), []byte("pwn3d"), 0644) + err = os.WriteFile(filepath.Join(data, "local-file"), []byte("pwn3d"), 0o644) assert.NilError(t, err) safe := filepath.Join(root, "safe") @@ -99,7 +99,7 @@ func TestTarWithMaliciousSymlinks(t *testing.T) { // Add a file into a directory above root // Ensure that we can't access this file while tarring. - err = os.WriteFile(filepath.Join(dir, "host-file"), hostFileData, 0644) + err = os.WriteFile(filepath.Join(dir, "host-file"), hostFileData, 0o644) assert.NilError(t, err) safe := filepath.Join(root, "safe")