@@ -22,91 +22,39 @@ abstract class SensitiveData extends DataFlow::Node {
2222}
2323
2424/**
25- * A function that might produce sensitive data.
25+ * A function call or enum variant data flow node that might produce sensitive data.
2626 */
27- private class SensitiveDataFunction extends Function {
27+ private class SensitiveDataCall extends SensitiveData {
2828 SensitiveDataClassification classification ;
2929
30- SensitiveDataFunction ( ) {
31- HeuristicNames:: nameIndicatesSensitiveData ( this .getName ( ) .getText ( ) , classification )
32- }
33-
34- SensitiveDataClassification getClassification ( ) { result = classification }
35- }
36-
37- /**
38- * A function call data flow node that might produce sensitive data.
39- */
40- private class SensitiveDataFunctionCall extends SensitiveData {
41- SensitiveDataClassification classification ;
42-
43- SensitiveDataFunctionCall ( ) {
44- classification =
45- this .asExpr ( )
46- .getAstNode ( )
47- .( CallExprBase )
48- .getStaticTarget ( )
49- .( SensitiveDataFunction )
50- .getClassification ( )
51- }
52-
53- override SensitiveDataClassification getClassification ( ) { result = classification }
54- }
55-
56- /**
57- * An enum variant that might produce sensitive data.
58- */
59- private class SensitiveDataVariant extends Variant {
60- SensitiveDataClassification classification ;
61-
62- SensitiveDataVariant ( ) {
63- HeuristicNames:: nameIndicatesSensitiveData ( this .getName ( ) .getText ( ) , classification )
64- }
65-
66- SensitiveDataClassification getClassification ( ) { result = classification }
67- }
68-
69- /**
70- * An enum variant call data flow node that might produce sensitive data.
71- */
72- private class SensitiveDataVariantCall extends SensitiveData {
73- SensitiveDataClassification classification ;
74-
75- SensitiveDataVariantCall ( ) {
76- classification =
77- this .asExpr ( ) .getAstNode ( ) .( CallExpr ) .getVariant ( ) .( SensitiveDataVariant ) .getClassification ( )
30+ SensitiveDataCall ( ) {
31+ exists ( CallExprBase call , string name |
32+ call = this .asExpr ( ) .getExpr ( ) and
33+ name =
34+ [
35+ call .getStaticTarget ( ) .( Function ) .getName ( ) .getText ( ) ,
36+ call .( CallExpr ) .getVariant ( ) .getName ( ) .getText ( ) ,
37+ ] and
38+ HeuristicNames:: nameIndicatesSensitiveData ( name , classification )
39+ )
7840 }
7941
8042 override SensitiveDataClassification getClassification ( ) { result = classification }
8143}
8244
83- /**
84- * A variable that might contain sensitive data.
85- */
86- private class SensitiveDataVariable extends Variable {
87- SensitiveDataClassification classification ;
88-
89- SensitiveDataVariable ( ) {
90- HeuristicNames:: nameIndicatesSensitiveData ( this .getText ( ) , classification )
91- }
92-
93- SensitiveDataClassification getClassification ( ) { result = classification }
94- }
95-
9645/**
9746 * A variable access data flow node that might be sensitive data.
9847 */
9948private class SensitiveVariableAccess extends SensitiveData {
10049 SensitiveDataClassification classification ;
10150
10251 SensitiveVariableAccess ( ) {
103- classification =
104- this .asExpr ( )
52+ HeuristicNames:: nameIndicatesSensitiveData ( this .asExpr ( )
10553 .getAstNode ( )
10654 .( VariableAccess )
10755 .getVariable ( )
108- .( SensitiveDataVariable )
109- .getClassification ( )
56+ .( Variable )
57+ .getText ( ) , classification )
11058 }
11159
11260 override SensitiveDataClassification getClassification ( ) { result = classification }
0 commit comments