fix: close CodeQL path-injection and integer-overflow alerts - #17
Merged
Conversation
Closes the 4 high-severity code-scanning alerts. - memory Reader (go/path-injection, reader.go): validate the cleaned user-supplied path with filepath.IsLocal — rejects absolute paths, "..", and any escape, and is recognized as a path-traversal sanitizer — backed by the existing within-root prefix check as defense in depth. - config budget (go/incorrect-integer-conversion, config.go): clamp the parsed int64 loop/seconds values to math.MaxInt32 before narrowing to int32, so an out-of-range value can't overflow. Adds a regression test. Fixes #10 Fixes #11
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes the 4 high-severity code-scanning (Security & Quality) alerts.
go/path-injection,internal/memory/reader.go) —safeJoinnow validates the cleaned user-supplied path withfilepath.IsLocal(rejects absolute paths,.., and any escape; recognized by CodeQL as a path-traversal sanitizer), keeping the within-root prefix check as defense in depth. Closes alerts feat: human-in-the-loop approval gate (step 7) #3, chore: add CODEOWNERS #4.go/incorrect-integer-conversion,internal/config/config.go) — clamp the parsedint64loop/seconds budgets tomath.MaxInt32before narrowing toint32. Adds a regression test. Closes alerts chore(ci): bump actions/setup-go from 5 to 6 #1, chore(ci): bump actions/checkout from 4 to 6 #2.Fixes #10
Fixes #11
Verified:
go test -race ./...green; existing traversal + new overflow tests pass. TheCodeQLcheck on this PR should now show those alerts resolved.