Repository navigation
docs(security): add inline CodeQL sanitizer comments at 5 path-injection sites - #491
Closed
liususan091219 wants to merge 1 commit into
Closed
liususan091219 wants to merge 1 commit into
liususan091219 wants to merge 1 commit into
Conversation
…ion sites Adds explicit comment markers at every sanitization layer (regex strip + is_relative_to bound check) so the won't-fix dismissal rationale is visible in the source. No code logic change; both files parse cleanly. Sites covered: - src/agent-api.py: _safe_path helper, /media/ handler, answer-task POST - src/dashboard.py: GET /notes/, DELETE /notes/ Pairs with dismissal of CodeQL alerts #17, #18, #19, #23, #28, #29, #30, #31, #45, #46, #47 (py/path-injection) — all confirmed sanitized via local CodeQL re-run + code review on 2026-04-21. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Superseded by the call-site fix in fix/codeql-path-injection-callsites — #491 was comments-only and CodeQL ignores comments. Actual repair switches to os.path.realpath + str.startswith (the pair CodeQL models as path-injection sanitizers). Verified locally: 11 → 0 alerts. — Lucy (Mac Studio bot) |
4 of 5 tasks
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.
Summary
Adds explicit comment markers at every sanitization layer (regex strip +
is_relative_tobound check) so the won't-fix dismissal rationale for the openpy/path-injectionalerts is visible directly in the source.No code logic change — comments only. Both files parse cleanly.
Sites covered
src/agent-api.py—_safe_pathhelper docstring + 2 sanitizer markers;/media/handler 3-of-3 markers; answer-task POST handler 2-of-2 markerssrc/dashboard.py— GET/notes/handler 3-of-3 markers; DELETE/notes/handler 3-of-3 markersEach marker reads e.g.:
# CodeQL sanitizer (1/3): regex allowlist strips everything except [a-zA-Z0-9_./-]Background
After the post-merge audit on Chi's #485-#488 closed 9 of 18 alerts, 11 path-injection alerts remained open (#17, #18, #19, #23, #28, #29, #30, #31, #45, #46, #47). Local CodeQL re-run on 2026-04-21 (codeql 2.25.2 + custom model-pack experiments) confirmed:
is_relative_tobound checkpy/path-injectionquery doesn't recognizePath.is_relative_toas a sanitizerbarrierGuardModel+barrierModelexperiments didn't close the alerts (likely needs custom QL extension, not just YAML)Per Susan's direction, dismissing these 11 alerts as won't-fix once this PR merges, with each dismissal referencing the comment-marker line. The comments make the inline sanitization explicitly visible to future readers + auditors so the dismissal isn't blind.
Test plan
python3 -c "import ast; ast.parse(open('src/agent-api.py').read()); ast.parse(open('src/dashboard.py').read())"passesgit diff --statconfirms +32/-7 (comments only)🤖 Generated with Claude Code