@@ -8,20 +8,19 @@ private import semmle.code.java.security.Encryption
88private import semmle.code.java.frameworks.Properties
99private import semmle.code.java.dataflow.RangeUtils
1010
11- class GetPropertyMethodAccess extends MethodAccess {
11+ private class GetPropertyMethodAccess extends MethodAccess {
1212 GetPropertyMethodAccess ( ) { this .getMethod ( ) instanceof PropertiesGetPropertyMethod }
1313
1414 private ConfigPair getPair ( ) {
1515 this .getArgument ( 0 ) .( ConstantStringExpr ) .getStringValue ( ) = result .getNameElement ( ) .getName ( )
1616 }
1717
18- string getValue ( ) {
18+ string getPropertyValue ( ) {
1919 result = this .getPair ( ) .getValueElement ( ) .getValue ( ) or
2020 result = this .getArgument ( 1 ) .( ConstantStringExpr ) .getStringValue ( )
2121 }
2222}
2323
24- string getWeakHashingAlgorithm ( DataFlow:: Node node ) {
2524/**
2625 * Get the name of the weak cryptographic algorithm represented by `node`.
2726 */
@@ -40,11 +39,9 @@ string getWeakHashingAlgorithmName(DataFlow::Node node) {
4039 */
4140module InsecureAlgorithmPropertyConfig implements DataFlow:: ConfigSig {
4241 predicate isSource ( DataFlow:: Node n ) {
43- exists ( MethodAccess ma , ConfigPair pair |
44- n .asExpr ( ) = ma and ma .getMethod ( ) instanceof PropertiesGetPropertyMethod
45- |
46- ma .getArgument ( 0 ) .( ConstantStringExpr ) .getStringValue ( ) = pair .getNameElement ( ) .getName ( ) and
47- not pair .getValueElement ( ) .getValue ( ) .regexpMatch ( getSecureAlgorithmRegex ( ) )
42+ exists ( GetPropertyMethodAccess ma , string algo | n .asExpr ( ) = ma |
43+ algo = ma .getPropertyValue ( ) and
44+ not algo .regexpMatch ( getSecureAlgorithmRegex ( ) )
4845 )
4946 }
5047
0 commit comments