Repository navigation
Conversation
The ruff backlog has been cleared (secfoo-com#194, secfoo-com#196, secfoo-com#198), so drop the `|| true` and pin ruff in the dev extra so a new ruff release can't turn unrelated PRs red. Add a Security job that runs bandit at medium severity and above and pip-audit on the installed environment, both blocking. Replace the assert in runner._target_workdir with a real check (asserts are stripped under -O) and annotate the reviewed bandit false positives with `# nosec` and a reason. Document the three commands as the pre-PR checklist in CONTRIBUTING.md. Fixes secfoo-com#114.
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 #114
What does this change, and why?
CI ran
ruff check . || true, so lint could never fail a build. bandit and pip-audit were in thedevextra but nothing ran them. This makes all three blocking.|| trueremoved. The backlog from the issue was already cleared by test: resolve ruff lint findings in tests/ #194, fix(lint): resolve the error-handling ruff findings in src #196 and chore(lint): apply ruff's safe autofixes (Optional[X], __all__ order, regex flags) #198. ruff is now pinned (ruff==0.17.6) in thedevextra so the result is reproducible; bump it on purpose.Security (bandit, pip-audit)job runsbandit -r src/secfoo -c .bandit -ll(medium and above), blocking.pip-audit --skip-editableon the installed environment after upgrading pip. It's blocking, and secfoo itself is skipped because the editable install may be ahead of the latest release. No advisories are accepted today; the step's comment shows the--ignore-vuln <ID>format and asks for a date and reason on each entry.ruff format --checkis not added: formatting the whole codebase would be a large unrelated diff, so that should be a follow-up issue.CONTRIBUTING.md: new pre-PR checklist with the three commands and how to handle an intentional exception for each.Bandit findings: fixed
runner.py_target_workdir:assert resolved.path is not None(B101) is now a real check that raisesValueError, because asserts are stripped underpython -O. Covered bytests/test_runner_target_workdir.py.Bandit findings: annotated as false positives (
# nosecwith reason)storage/repository.pycost_summary(B608):group_sqlcomes from a fixed dict lookup.storage/repository.pyruns-table migration (B608): column names come fromPRAGMA table_info(runs), not user input.cli.pySECRET = "secret-scanning"(B105): a skill id, not a password.web/security.pyWILDCARD_BINDS(B104): the set used to detect and guard wildcard binds; nothing binds to it.report/evidence.py'/tmp/evaluator'(B108): replacement text in a path scrubber, never opened as a file.cloud.py,memory.py,osv.pyurllib.request.Request(...)(B310): the matchingurlopenlines were already annotated; these are the user-configured portal/memory URL and the hardcoded OSV.dev URL.sensor/probe.pytwoexcept Exception: pass(B110, Low): these run inside the user's application while it shuts down or disables the probe. The probe must never raise into the app or log through its handlers, so they stay silent on purpose. Runner's other broad excepts already log at debug level.Testing
Ran
pytestin a clean Linux container: the 4 remaining failure(s) also occur on the base branch without this change; no new failures are introduced.pytest testspassesruff check .passesThis PR was prepared with AI assistance (Claude) and reviewed by me before submitting.