Skip to content

Commit 7ef40f8

Browse files
chris-rockclaude
andcommitted
fix: add nolint:gosec for G703 path traversal in test cleanup
The temp file path comes from os.CreateTemp which is safe. The newer CI linter (v2.10.1) flags this as G703 path traversal via taint analysis. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 53dc015 commit 7ef40f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controllers/k8s_scan/deployment_handler_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,8 @@ func (s *DeploymentHandlerSuite) createDeploymentHandlerWithVaultMock(vaultFetch
748748
_, err = tmpFile.WriteString("fake-sa-jwt-token")
749749
s.Require().NoError(err)
750750
s.Require().NoError(tmpFile.Close())
751-
s.T().Cleanup(func() { _ = os.Remove(tmpFile.Name()) })
751+
tmpName := tmpFile.Name()
752+
s.T().Cleanup(func() { _ = os.Remove(tmpName) }) //nolint:gosec
752753

753754
return DeploymentHandler{
754755
KubeClient: s.fakeClientBuilder.Build(),

0 commit comments

Comments
 (0)