File tree Expand file tree Collapse file tree 2 files changed +31
-4
lines changed
test/library-tests/sensitivedata Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ private class SensitiveDataFunction extends Function {
37
37
/**
38
38
* A function call data flow node that might produce sensitive data.
39
39
*/
40
- private class SensitiveDataCall extends SensitiveData {
40
+ private class SensitiveDataFunctionCall extends SensitiveData {
41
41
SensitiveDataClassification classification ;
42
42
43
- SensitiveDataCall ( ) {
43
+ SensitiveDataFunctionCall ( ) {
44
44
classification =
45
45
this .asExpr ( )
46
46
.getAstNode ( )
@@ -53,6 +53,33 @@ private class SensitiveDataCall extends SensitiveData {
53
53
override SensitiveDataClassification getClassification ( ) { result = classification }
54
54
}
55
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 ( )
78
+ }
79
+
80
+ override SensitiveDataClassification getClassification ( ) { result = classification }
81
+ }
82
+
56
83
/**
57
84
* A variable that might contain sensitive data.
58
85
*/
Original file line number Diff line number Diff line change @@ -293,8 +293,8 @@ fn test_private_info(
293
293
sink ( info. financials . iban . as_str ( ) ) ; // $ MISSING: sensitive=private
294
294
sink ( info. financials . iBAN . as_str ( ) ) ; // $ MISSING: sensitive=private
295
295
296
- sink ( ContactDetails :: HomePhoneNumber ( "123" . to_string ( ) ) ) ; // $ MISSING: sensitive=private
297
- sink ( ContactDetails :: MobileNumber ( "123" . to_string ( ) ) ) ; // $ MISSING: sensitive=private
296
+ sink ( ContactDetails :: HomePhoneNumber ( "123" . to_string ( ) ) ) ; // $ sensitive=private
297
+ sink ( ContactDetails :: MobileNumber ( "123" . to_string ( ) ) ) ; // $ sensitive=private
298
298
sink ( ContactDetails :: Email ( "a@b" . to_string ( ) ) ) ; // $ MISSING: sensitive=private
299
299
if let ContactDetails :: MobileNumber ( num) = details {
300
300
sink ( num. as_str ( ) ) ; // $ MISSING: sensitive=private
You can’t perform that action at this time.
0 commit comments