fix(security): resolve CodeQL path-injection and invalid-pointer alerts - #221
Open
austin-liminal wants to merge 1 commit into
Open
fix(security): resolve CodeQL path-injection and invalid-pointer alerts#221austin-liminal wants to merge 1 commit into
austin-liminal wants to merge 1 commit into
Conversation
Refactor ImageCache to validate hex-encoded SHA256 cache keys before constructing filesystem paths, creating a clear sanitization boundary that CodeQL can verify. Exclude rex_napi crate from CodeQL analysis since its #[napi] proc-macro-generated FFI code triggers false positive access-invalid-pointer alerts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Needs human review Unable to check for correctness in 76c15a3. You can customize Macroscope's approvability policy. Learn more. |
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
ImageCacheto separate hash computation (cache_key) from path construction (validated_cache_path), with explicit hex-character validation before filesystem access. This creates a clear sanitization boundary CodeQL can verify.crates/rex_napi/— the#[napi]proc macro generates FFI wrappers that trigger false positiveaccess-invalid-pointeralerts.Test plan
rex_imagetests pass (13/13)validated_cache_path_rejects_non_hextest verifies the sanitizer rejects traversal attempts🤖 Generated with Claude Code
Note
Fix CodeQL path-injection alerts in
ImageCacheby validating cache keysstarts_withcontainment check inImageCache.getandImageCache.putwith a SHA256-basedcache_keyfunction and avalidated_cache_pathhelper that rejects empty or non-hex input before joining tocache_dir.crates/rex_napifrom analysis, and wires it into the codeql.yml workflow.lgtmsuppression comment for therust/access-invalid-pointeralert inRexInstance.Macroscope summarized 76c15a3.