fix(python-security): stop reporting pip-audit transport failures as vulnerabilities - #2186
Open
seonghobae wants to merge 1 commit into
Open
fix(python-security): stop reporting pip-audit transport failures as vulnerabilities#2186seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
…vulnerabilities Closes #2158. The hard gate folded every non-zero pip-audit exit into one message asserting known-vulnerable dependencies, so a PyPI advisory-query ConnectionResetError (no findings at all) read as a security finding and misdirected triage on #2157. Each invocation now runs through run_audit(), which keeps the gate closed on any failure but classifies it: pip-audit 2.10.1 prints "Found N known vulnerabilit(y|ies) ... in N package(s)" on stderr only when it has findings (pip_audit/_cli.py), so that line selects the finding error; anything else is reported as an audit-service/transport failure with the last diagnostic line and a rerun instruction. No retry budget is added (directive 3.1). Behaviour test executes the real step body with a fake pip-audit on PATH: findings -> exit 1 + finding error; traceback without findings -> exit 1 + could-not-complete error; clean -> exit 0, no ::error. RED on main. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 30 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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 #2158.
Defect
.github/workflows/python-security.yml's "Run pip-audit (hard gate on any known vulnerability)" step folded every non-zeropip-auditexit into one message —pip-audit reported known-vulnerable Python dependencies.— so a PyPI advisory-queryConnectionResetErrorwith no findings (.github#2123@7e3b1a40c, job103582668686) read as a security finding and sent #2157's triage looking for dependencies to remediate.Change (one step, fail-closed preserved)
Each invocation now goes through a
run_audit <label> <args…>function in the same step:status=1(the gate stays closed on every failure);Found N known vulnerabilit…— the summary pip-audit 2.10.1 (the pinned version) prints on stderr only when it has findings (pip_audit/_cli.py) — the step emits::error::pip-audit found known-vulnerable Python dependencies in <input>;::error::pip-audit could not complete for <input>: <last diagnostic line>. This is an audit-service/transport failure, not a vulnerability finding; rerun the job before treating it as a security result.No retry budget is added (directive 3.1: a retry would need a provider-stated condition). The three call sites (
-rnormal,-r --disable-pip --no-depsfor overridden locks, project manifest) and their flags are unchanged.Verification
tests/test_python_security_pip_audit_failure_classification.pyexecutes the real step body (extracted from the workflow, same technique astest_workflow_file_detection_pipefail_regression.py) with a fakepip-auditonPATH:No known vulnerabilities found+ traceback + exit 1 (the python-security: pip-audit transport/exception failures are reported as "known-vulnerable Python dependencies" #2158 shape) → exit 1 + could-not-complete error namingConnectionResetError, no "known-vulnerable";::error::;RED against
main's step (3 of 4 fail), GREEN here (4/4). Full suite: 3082 passed, 3 skipped, 0 warnings;interrogate100%. Localcoverageshows 99% only becausetests/test_noema_document_review_context.pyskips the hwp-mcp fixture cases withoutNOEMA_HWP_MCP_SOURCE(modules from fix(noema): close document reader review gaps #2178, untouched here); the hosted gate runs with that source.Sequencing note
#2158 suggested bundling into #1051; that PR has been idle since 2026-09-03 and its diff does not touch the failure-reporting lines, so this lands independently and should apply cleanly on either side.
🤖 Generated with Claude Code