Add Semgrep SAST to CI + pre-commit#37
Merged
Merged
Conversation
Adds a Semgrep static-analysis gate complementing CodeQL, running the p/python, p/security-audit, and p/command-injection rulesets over src/: - New "Semgrep (SAST)" job in security-scan.yml (via uv run --with, no token). - Matching local pre-commit hook so findings surface before commit. Resolves the one baseline finding: _fetch_json now pins the scheme to https (so a file:// URL can never reach urlopen) with a justified nosemgrep on the verified-safe call.
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.
Adds a Semgrep static-analysis gate complementing the existing CodeQL setup.
What
uv run --with semgrep(no token),--errorso it blocks on findings.Baseline finding resolved
The one finding (
dynamic-urllib-use-detectedin cli/update.py) is genuinely addressed:_fetch_jsonnow pins the scheme to https:// so a file:// URL can never reach urlopen,with a justified
# nosemgrepon the verified-safe call (all callers pass hardcoded GitHub API constants).Verification
Clean scan (0 findings, exit 0) locally; the pre-commit hook ran and passed on this branch's commit. The Semgrep (SAST) job runs on this PR.