refactor(taint): deduplicate shared engine mechanics#287
refactor(taint): deduplicate shared engine mechanics#287Darkroom4364 wants to merge 2 commits intomainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughRefactors taint analysis by centralizing batched rule grouping, sink matching, and finding construction in ChangesTaint Engine Deduplication
Sequence Diagram(s)sequenceDiagram
participant Rules as Rules Input
participant Batcher as taint_engine::build_batched_taint_groups
participant Analyzer as Language Analyzer (Go/JS/Py)
participant Matcher as taint_engine::match_*_sink
participant Findings as taint_engine::push_attributed_findings / output
Note over Rules,Batcher: rules grouped by sanitizer fingerprints
Rules->>Batcher: provide BatchedRule list
Batcher-->>Analyzer: emit BatchedTaintGroup(s) (spec, sink_to_rules)
Analyzer->>Matcher: detect sink matches during traversal
Matcher-->>Analyzer: MatchedSink (description, attribution_key, rule_ids)
Analyzer->>Findings: create TaintFinding(s) via taint_finding_for_node / cross_file_taint_finding
Findings->>Findings: fan-out findings by sink_to_rules (push_attributed_findings)
Findings-->>Rules: emit attributed findings per rule id
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/rules/taint_engine.rs`:
- Around line 188-205: The code currently deduplicates and attributes sinks
using human-readable sink.description(), causing lost/misattributed findings
when descriptions collide; change dedup/attribution to use a matcher-stable key
(e.g. matcher_fingerprint(...) for each sink matcher) instead of description:
replace seen_sink_descs and sink_to_rule mapping to track matcher fingerprints
and map each fingerprint to a Vec<String> of rule IDs (not a single String),
update merged_sources/merged_sinks logic to dedupe by fingerprint, and modify
match_call_sink / match_member_assign_sink to return all owning rule_ids for
matched sinks so push_attributed_findings can fan out and emit one finding per
rule_id.
🪄 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 Plus
Run ID: d468f4fe-f7c7-4c09-9459-2a716beaf71a
📒 Files selected for processing (4)
src/rules/go_taint.rssrc/rules/javascript_taint.rssrc/rules/python_taint.rssrc/rules/taint_engine.rs
Summary
Closes #276
Test plan
Summary by CodeRabbit