@@ -8,10 +8,12 @@ import semmle.code.java.dataflow.DataFlow2
8
8
import HardcodedCredentials
9
9
10
10
/**
11
+ * DEPRECATED: Use `HardcodedCredentialSourceCallFlow` instead.
12
+ *
11
13
* A data-flow configuration that tracks hardcoded expressions flowing to a parameter whose name suggests
12
14
* it may be a credential, excluding those which flow on to other such insecure usage sites.
13
15
*/
14
- class HardcodedCredentialSourceCallConfiguration extends DataFlow:: Configuration {
16
+ deprecated class HardcodedCredentialSourceCallConfiguration extends DataFlow:: Configuration {
15
17
HardcodedCredentialSourceCallConfiguration ( ) {
16
18
this = "HardcodedCredentialSourceCallConfiguration"
17
19
}
@@ -22,10 +24,28 @@ class HardcodedCredentialSourceCallConfiguration extends DataFlow::Configuration
22
24
}
23
25
24
26
/**
27
+ * A data-flow configuration that tracks hardcoded expressions flowing to a parameter whose name suggests
28
+ * it may be a credential, excluding those which flow on to other such insecure usage sites.
29
+ */
30
+ module HardcodedCredentialSourceCallConfig implements DataFlow:: ConfigSig {
31
+ predicate isSource ( DataFlow:: Node n ) { n .asExpr ( ) instanceof HardcodedExpr }
32
+
33
+ predicate isSink ( DataFlow:: Node n ) { n .asExpr ( ) instanceof FinalCredentialsSourceSink }
34
+ }
35
+
36
+ /**
37
+ * Tracks hardcoded expressions flowing to a parameter whose name suggests
38
+ * it may be a credential, excluding those which flow on to other such insecure usage sites.
39
+ */
40
+ module HardcodedCredentialSourceCallFlow = DataFlow:: Global< HardcodedCredentialSourceCallConfig > ;
41
+
42
+ /**
43
+ * DEPRECATED: Use `HardcodedCredentialParameterSourceCallFlow` instead.
44
+ *
25
45
* A data-flow configuration that tracks flow from an argument whose corresponding parameter name suggests
26
46
* a credential, to an argument to a sensitive call.
27
47
*/
28
- class HardcodedCredentialSourceCallConfiguration2 extends DataFlow2:: Configuration {
48
+ deprecated class HardcodedCredentialSourceCallConfiguration2 extends DataFlow2:: Configuration {
29
49
HardcodedCredentialSourceCallConfiguration2 ( ) {
30
50
this = "HardcodedCredentialSourceCallConfiguration2"
31
51
}
@@ -35,17 +55,33 @@ class HardcodedCredentialSourceCallConfiguration2 extends DataFlow2::Configurati
35
55
override predicate isSink ( DataFlow:: Node n ) { n .asExpr ( ) instanceof CredentialsSink }
36
56
}
37
57
58
+ /**
59
+ * A data-flow configuration that tracks flow from an argument whose corresponding parameter name suggests
60
+ * a credential, to an argument to a sensitive call.
61
+ */
62
+ module HardcodedCredentialParameterSourceCallConfig implements DataFlow:: ConfigSig {
63
+ predicate isSource ( DataFlow:: Node n ) { n .asExpr ( ) instanceof CredentialsSourceSink }
64
+
65
+ predicate isSink ( DataFlow:: Node n ) { n .asExpr ( ) instanceof CredentialsSink }
66
+ }
67
+
68
+ /**
69
+ * Tracks flow from an argument whose corresponding parameter name suggests
70
+ * a credential, to an argument to a sensitive call.
71
+ */
72
+ module HardcodedCredentialParameterSourceCallFlow =
73
+ DataFlow:: Global< HardcodedCredentialParameterSourceCallConfig > ;
74
+
38
75
/**
39
76
* An argument to a call, where the parameter name corresponding
40
77
* to the argument indicates that it may contain credentials, and
41
78
* where this expression does not flow on to another `CredentialsSink`.
42
79
*/
43
80
class FinalCredentialsSourceSink extends CredentialsSourceSink {
44
81
FinalCredentialsSourceSink ( ) {
45
- not exists ( HardcodedCredentialSourceCallConfiguration2 conf , CredentialsSink other |
46
- this != other
47
- |
48
- conf .hasFlow ( DataFlow:: exprNode ( this ) , DataFlow:: exprNode ( other ) )
82
+ not exists ( CredentialsSink other | this != other |
83
+ HardcodedCredentialParameterSourceCallFlow:: flow ( DataFlow:: exprNode ( this ) ,
84
+ DataFlow:: exprNode ( other ) )
49
85
)
50
86
}
51
87
}
0 commit comments