@@ -18,6 +18,10 @@ private import codeql.rust.frameworks.stdlib.Builtins as Builtins
1818 */
1919extensible predicate excludeFieldTaintStep ( string field ) ;
2020
21+ /**
22+ * Holds if the content `c` corresponds to a field that has explicitly been
23+ * excluded as a taint step.
24+ */
2125private predicate excludedTaintStepContent ( Content c ) {
2226 exists ( string arg | excludeFieldTaintStep ( arg ) |
2327 FlowSummaryImpl:: encodeContentStructField ( c , arg ) or
@@ -47,19 +51,9 @@ module RustTaintTracking implements InputSig<Location, RustDataFlow> {
4751 or
4852 // Read steps give rise to taint steps. This has the effect that if `foo`
4953 // is tainted and an operation reads from `foo` (e.g., `foo.bar`) then
50- // taint is propagated. We limit this to not apply if the type of the
51- // operation is a small primitive type as these are often uninteresting
52- // (for instance in the case of an injection query).
54+ // taint is propagated.
5355 exists ( Content c |
5456 RustDataFlow:: readContentStep ( pred , c , succ ) and
55- forex ( Type:: Type t | t = TypeInference:: inferType ( succ .asExpr ( ) ) |
56- not exists ( Struct s | s = t .( Type:: StructType ) .getStruct ( ) |
57- s instanceof Builtins:: NumericType or
58- s instanceof Builtins:: Bool or
59- s instanceof Builtins:: Char
60- ) and
61- not t .( Type:: EnumType ) .getEnum ( ) .isFieldless ( )
62- ) and
6357 not excludedTaintStepContent ( c )
6458 )
6559 or
0 commit comments