Repository navigation
fix(sandbox): annotate the hidden-path Lstat for gosec G703 - #670
Merged
Merged
Conversation
gosec's taint analysis reports G703 (path traversal) on the os.Lstat in hidePath, but only on some runs: dependabot PR #668 failed lint on it when the module cache failed to restore, and passed on a rerun. A release build that hits a cold cache would fail the same way. The finding does not apply. p names a path the policy wants hidden, and hidePath only covers it with an empty tmpfs or /dev/null, so a traversal in p can hide more but never lets the command read more. Signed-off-by: Ion Alpha <contact@ionalpha.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
//nolint:gosecwith its reason to theos.LstatinhidePath(sandbox/readdeny_linux.go).Why
gosec reports G703 (path traversal via taint analysis) on that line, but only on some runs. Dependabot PR #668 failed
Lint & formaton it when the module cache failed to restore, then passed on a rerun of the same commit; main passed on the same base. A release build that starts from a cold cache would fail the same way.The finding does not apply:
pnames a path the read-deny policy wants hidden, andhidePathonly covers it with an empty tmpfs or/dev/null. A traversal inpcan hide more, never let the command read more.How to verify
CI
Lint & formatis green. No behaviour change, so no new test.Notes for reviewers
nolintlintis not enabled, so the annotation does not fail lint on runs where gosec stays quiet.