fix(security): annotate fixed-prefix maturin urlopen for Bandit B310 - #2501
Open
seonghobae wants to merge 1 commit into
Open
seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
ab2e9db added an unannotated urlopen in verify_release_maturin_tool_assets.py. The pinned Bandit gate (MEDIUM/MEDIUM) now fails on main and on every PR. The URL is a fixed https://github.com prefix and the filename is allowlisted before fetch, so mark it the same way as the other audited urlopen sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDHB12uwrJ5Uzm8gNSz52N
Contributor
|
Warning Review limit reachedNext included review available in 37 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 (1)
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 |
2 tasks
| url = f"https://github.com/PyO3/maturin/releases/download/v1.15.0/{filename}" | ||
| with urlopen(Request(url, headers={"User-Agent": "cwl-release-gate"}), timeout=60) as response: | ||
| # URL is a fixed https://github.com prefix; only the vetted asset filename varies. | ||
| with urlopen(Request(url, headers={"User-Agent": "cwl-release-gate"}), timeout=60) as response: # nosec B310 |
This branch has not been deployed
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.
Why
ab2e9db12(#2347 line) addedurlopeninscripts/ci/verify_release_maturin_tool_assets.py:36without a B310 annotation. The pinned Bandit gate (--severity-level medium --confidence-level medium) therefore fails on currentmainand on every PR that runs Python Security (e.g. #2253).Change
One inline
# nosec B310plus a one-line reason, the same pattern used inmaterialize_base_python_requirements.py,noema_review_gate.pyandsandboxed_web_e2e.py. The URL is a fixedhttps://github.com/PyO3/maturin/releases/download/v1.15.0/prefix andverify_assetsallowlistsasset_filename(line 72) before calling fetch, so nofile:or custom scheme is reachable.Evidence
requirements-bandit-ci-hashes.txtBandit, the exact workflow command, onorigin/main3295c25: rc=1,scripts/ci/verify_release_maturin_tool_assets.py:36 B310 MEDIUM.pytest tests/test_verify_release_maturin_tool_assets.py: 7 passed.Developer experience: Python Security goes green again for unrelated PRs.
User experience: no behavior change.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WDHB12uwrJ5Uzm8gNSz52N