@@ -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
@@ -59,19 +63,9 @@ module RustTaintTracking implements InputSig<Location, RustDataFlow> {
5963 or
6064 // Read steps give rise to taint steps. This has the effect that if `foo`
6165 // is tainted and an operation reads from `foo` (e.g., `foo.bar`) then
62- // taint is propagated. We limit this to not apply if the type of the
63- // operation is a small primitive type as these are often uninteresting
64- // (for instance in the case of an injection query).
66+ // taint is propagated.
6567 exists ( Content c |
6668 RustDataFlow:: readContentStep ( pred , c , succ ) and
67- forex ( Type:: Type t | t = TypeInference:: inferType ( succ .asExpr ( ) ) |
68- not exists ( Struct s | s = t .( Type:: StructType ) .getStruct ( ) |
69- s instanceof Builtins:: NumericType or
70- s instanceof Builtins:: Bool or
71- s instanceof Builtins:: Char
72- ) and
73- not t .( Type:: EnumType ) .getEnum ( ) .isFieldless ( )
74- ) and
7569 not excludedTaintStepContent ( c )
7670 )
7771 or
0 commit comments