@@ -22,91 +22,39 @@ abstract class SensitiveData extends DataFlow::Node {
22
22
}
23
23
24
24
/**
25
- * A function that might produce sensitive data.
25
+ * A function call or enum variant data flow node that might produce sensitive data.
26
26
*/
27
- private class SensitiveDataFunction extends Function {
27
+ private class SensitiveDataCall extends SensitiveData {
28
28
SensitiveDataClassification classification ;
29
29
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
+ )
78
40
}
79
41
80
42
override SensitiveDataClassification getClassification ( ) { result = classification }
81
43
}
82
44
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
-
96
45
/**
97
46
* A variable access data flow node that might be sensitive data.
98
47
*/
99
48
private class SensitiveVariableAccess extends SensitiveData {
100
49
SensitiveDataClassification classification ;
101
50
102
51
SensitiveVariableAccess ( ) {
103
- classification =
104
- this .asExpr ( )
52
+ HeuristicNames:: nameIndicatesSensitiveData ( this .asExpr ( )
105
53
.getAstNode ( )
106
54
.( VariableAccess )
107
55
.getVariable ( )
108
- .( SensitiveDataVariable )
109
- .getClassification ( )
56
+ .( Variable )
57
+ .getText ( ) , classification )
110
58
}
111
59
112
60
override SensitiveDataClassification getClassification ( ) { result = classification }
0 commit comments