@@ -8,10 +8,12 @@ import semmle.code.java.dataflow.DataFlow2
88import HardcodedCredentials
99
1010/**
11+ * DEPRECATED: Use `HardcodedCredentialSourceCallFlow` instead.
12+ *
1113 * A data-flow configuration that tracks hardcoded expressions flowing to a parameter whose name suggests
1214 * it may be a credential, excluding those which flow on to other such insecure usage sites.
1315 */
14- class HardcodedCredentialSourceCallConfiguration extends DataFlow:: Configuration {
16+ deprecated class HardcodedCredentialSourceCallConfiguration extends DataFlow:: Configuration {
1517 HardcodedCredentialSourceCallConfiguration ( ) {
1618 this = "HardcodedCredentialSourceCallConfiguration"
1719 }
@@ -22,10 +24,28 @@ class HardcodedCredentialSourceCallConfiguration extends DataFlow::Configuration
2224}
2325
2426/**
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+ *
2545 * A data-flow configuration that tracks flow from an argument whose corresponding parameter name suggests
2646 * a credential, to an argument to a sensitive call.
2747 */
28- class HardcodedCredentialSourceCallConfiguration2 extends DataFlow2:: Configuration {
48+ deprecated class HardcodedCredentialSourceCallConfiguration2 extends DataFlow2:: Configuration {
2949 HardcodedCredentialSourceCallConfiguration2 ( ) {
3050 this = "HardcodedCredentialSourceCallConfiguration2"
3151 }
@@ -35,17 +55,33 @@ class HardcodedCredentialSourceCallConfiguration2 extends DataFlow2::Configurati
3555 override predicate isSink ( DataFlow:: Node n ) { n .asExpr ( ) instanceof CredentialsSink }
3656}
3757
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+
3875/**
3976 * An argument to a call, where the parameter name corresponding
4077 * to the argument indicates that it may contain credentials, and
4178 * where this expression does not flow on to another `CredentialsSink`.
4279 */
4380class FinalCredentialsSourceSink extends CredentialsSourceSink {
4481 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 ) )
4985 )
5086 }
5187}
0 commit comments