Skip to content

Commit 8d1f356

Browse files
Fix path traversal false positive in poutine output parsing (Alert #458) (#8802)
1 parent 119c238 commit 8d1f356

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pkg/cli/poutine.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ func parseAndDisplayPoutineOutputForDirectory(stdout string, verbose bool, gitRo
441441
}
442442

443443
// Read file content for context display
444+
// #nosec G304 -- absPath is validated through: 1) filepath.Clean() normalization,
445+
// 2) absolute path resolution, and 3) filepath.Rel() check ensuring it's within gitRoot
446+
// (lines 414-441). Path traversal attacks are prevented by the boundary validation.
444447
fileContent, err := os.ReadFile(absPath)
445448
var fileLines []string
446449
if err == nil {

0 commit comments

Comments
 (0)