File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
cpp/ql/src/Security/CWE/CWE-313 Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,14 @@ predicate sqlite_encryption_used() {
28
28
any ( FunctionCall fc ) .getTarget ( ) .getName ( ) .matches ( "sqlite%\\_key\\_%" )
29
29
}
30
30
31
+ /**
32
+ * Gets a field of the class `c`, or of another class contained in `c`.
33
+ */
34
+ Field getRecField ( Class c ) {
35
+ result = c .getAField ( ) or
36
+ result = getRecField ( c .getAField ( ) .getUnspecifiedType ( ) .stripType ( ) )
37
+ }
38
+
31
39
/**
32
40
* A taint flow configuration for flow from a sensitive expression to a `SqliteFunctionCall` sink.
33
41
*/
@@ -44,6 +52,19 @@ class FromSensitiveConfiguration extends TaintTracking::Configuration {
44
52
override predicate isSanitizer ( DataFlow:: Node node ) {
45
53
node .asExpr ( ) .getUnspecifiedType ( ) instanceof IntegralType
46
54
}
55
+
56
+ override predicate allowImplicitRead ( DataFlow:: Node node , DataFlow:: ContentSet content ) {
57
+ // flow out from fields at the sink (only).
58
+ isSink ( node ) and
59
+ // constrain `content` to a field inside the node.
60
+ exists ( Class c |
61
+ node .asExpr ( ) .getUnspecifiedType ( ) .stripType ( ) = c and
62
+ content .( DataFlow:: FieldContent ) .getField ( ) = getRecField ( c )
63
+ )
64
+ or
65
+ // any default implicit reads
66
+ super .allowImplicitRead ( node , content )
67
+ }
47
68
}
48
69
49
70
from
You can’t perform that action at this time.
0 commit comments