Rust: Source/sink/barrier MaD trait models apply to implementations - #3
anurag6569201 wants to merge 1 commit into
Conversation
Source PR: github#22445 Source head: 2d69fc3
|
| ) | ||
| } | ||
|
|
||
| bindingset[path] |
There was a problem hiding this comment.
Shipwright · HIGH
In the Rust 'interpretPath' predicate, the disjunction 'f = f0 and isExact = true and p = orig or f.implements(f0) and isExact = false and p = "hq-generated"' has no parentheses ar
Impact: In the Rust 'interpretPath' predicate, the disjunction 'f = f0 and isExact = true and p = orig or f.implements(f0) and isExact = false and p = "hq-generated"' has no parentheses around the two alternatives. In QL, 'and' binds tighter than 'or', so this parses as intended, but the missing grouping is fragile and easy to break during refactoring; a misplaced edit could make 'isExact'/'p' unconstrained or alter precede…
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
| ) | ||
| } | ||
|
|
||
| bindingset[path] |
There was a problem hiding this comment.
Shipwright · HIGH
The Rust 'interpretPath' change now applies inherited trait models with 'isExact = false' and provenance '"hq-generated"' for sources, sinks, barriers, and barrier guards.
Impact: The Rust 'interpretPath' change now applies inherited trait models with 'isExact = false' and provenance '"hq-generated"' for sources, sinks, barriers, and barrier guards. The test expectations show new inherited models appearing (e.g., '<_ as main::MySinkTrait3>::consume3'). This expands the attack surface of model propagation to all implementors of a trait, which can cause over-approximation and false positi…
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
This PR applies the same inheritance logic to source/sink/barrier MaD models for trait functions as for summary models, that is, a model for
<Foo>::barapplies to any function implementing the trait functionfoo, unless an explicit model exists for that particular implementation.In order to ensure that the same prioritization rules apply as for summary models, this logic is defined in the shared library, but currently only Rust and C++ make use of it.
The updated test output shows that we fix some existing FNs, and DCA shows that we both remove some alerts (presumably because we now have more barriers) and we gain some alerts (presumably because we now have more sources and sinks).
Source merge-base:
56dac46817d63cf9ca36d160e5f03249b65e8b74Source head:
2d69fc39e538a8c7d92357e327769add57e99778