fix: CodeQL path-injection alerts + bump vulnerable deps#22
fix: CodeQL path-injection alerts + bump vulnerable deps#22
Conversation
…cies CodeQL alerts (27 High "Uncontrolled data used in path expression"): - Add summaryModel YAML extension marking safe_path() and sanitize_chat_id() as taint barriers so CodeQL recognises the existing is_relative_to() / input-validation checks. - Wire codeql-config.yml into the analysis workflow. Dependency vulnerabilities (High severity): - urllib3 2.5.0 → 2.6.3 (CVE-2026-21441 decompression + redirects) - pillow 11.3.0 → 12.1.1 (PSD out-of-bounds write) - pdfminer.six 20250506 → 20260107 (pickle deserialization + code exec) - cryptography 46.0.2 → 46.0.6 (SECT curves subgroup attack) - PyJWT 2.7.0 → 2.12.1 (unknown crit header extensions) - python-multipart 0.0.20 → 0.0.22 (arbitrary file write) https://claude.ai/code/session_01FGhcXsPy8oV4EqLmscWckB
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds CodeQL config and a Python model extension marking specific functions as sanitizers, updates the CodeQL workflow to load that config, bumps several Python dependency versions, and updates an image-resizing call to use PIL's Resampling enum. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/codeql/extensions/python-sanitizers.model.yml:
- Around line 17-22: The model for the safe_path function only marks Argument[0]
as contributing to ReturnValue, but safe_path(base_dir, *segments) combines
base_dir and all subsequent segments into the returned path; update the entry
for Member[safe_path] to model all arguments (use the range-syntax for
arguments, e.g. Argument[0..]) so CodeQL knows every input segment is validated
and the return value is sanitized.
In `@requirements.txt`:
- Line 21: The code uses the removed Pillow constant Image.LANCZOS (seen in
mcp_tools.py) which causes AttributeError with Pillow>=10; replace usages of
Image.LANCZOS with Image.Resampling.LANCZOS (e.g., change img.thumbnail((mx,mx),
Image.LANCZOS) to img.thumbnail((mx,mx), Image.Resampling.LANCZOS)) and ensure
imports reference PIL.Image so Image.Resampling is available; if
backward-compatibility is needed, add a small compatibility fallback that
resolves Resampling = getattr(Image, "Resampling", Image) before use.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 791b2d71-bea7-4c3b-94a6-6c56466a1bdb
📒 Files selected for processing (5)
.github/codeql/codeql-config.yml.github/codeql/extensions/python-sanitizers.model.yml.github/workflows/codeql.ymlcomputer-use-server/requirements.txtrequirements.txt
- Replace deprecated Image.LANCZOS with Image.Resampling.LANCZOS in mcp_tools.py (removed in Pillow 10.0+, breaks build with 12.x) - Use Argument[0..] range syntax in CodeQL summaryModel to cover safe_path() variadic *segments arguments https://claude.ai/code/session_01FGhcXsPy8oV4EqLmscWckB
pdfplumber 0.11.7 pins pdfminer.six==20250506, so bumping pdfminer.six alone to 20260107 broke pip resolution. Fix: bump pdfplumber 0.11.7 → 0.11.9 which pulls pdfminer.six==20251230. Version 20251230 fixes CVE-2025-64512 (pickle RCE via crafted PDF). https://claude.ai/code/session_01FGhcXsPy8oV4EqLmscWckB
Apply changes from PR #22 (community contribution): - mcp_tools.py: Image.LANCZOS → Image.Resampling.LANCZOS (Pillow 12 removed bare attribute) - requirements.txt: pillow 11→12.1.1, urllib3→2.6.3, cryptography→46.0.6, PyJWT→2.12.1, pdfminer.six→20251230, pdfplumber→0.11.9 - computer-use-server/requirements.txt: python-multipart→0.0.22 Add TDD test coverage for all changes: - tests/orchestrator/test_view_image.py: 15 tests for view() image path (Pillow 12 API guard, structured content return, all extensions, error handling) - tests/test_requirements.py: 7 version regression guards for CVE-patched deps Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolves changes from community PR #22.
Apply changes from PR #22 (community contribution): - mcp_tools.py: Image.LANCZOS → Image.Resampling.LANCZOS (Pillow 12 removed bare attribute) - requirements.txt: pillow 11→12.1.1, urllib3→2.6.3, cryptography→46.0.6, PyJWT→2.12.1, pdfminer.six→20251230, pdfplumber→0.11.9 - computer-use-server/requirements.txt: python-multipart→0.0.22 Add TDD test coverage for all changes: - tests/orchestrator/test_view_image.py: 15 tests for view() image path (Pillow 12 API guard, structured content return, all extensions, error handling) - tests/test_requirements.py: 7 version regression guards for CVE-patched deps Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolves changes from community PR #22.
Summary
summaryModelYAML extension (.github/codeql/extensions/python-sanitizers.model.yml) declaringsafe_path()andsanitize_chat_id()as taint barriers — CodeQL will recognise existingis_relative_to()/ input-validation checks instead of flagging false positives.Dependency updates
Not addressed (low risk)
Test plan
./tests/test-project-structure.shto confirm project structure intactstr.startswith()tosafe_path()https://claude.ai/code/session_01FGhcXsPy8oV4EqLmscWckB
Summary by CodeRabbit
Chores
Security
Bug Fixes