File tree Expand file tree Collapse file tree 5 files changed +7
-7
lines changed
semmle/code/java/security
test/library-tests/Encryption Expand file tree Collapse file tree 5 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ private class ShortStringLiteral extends StringLiteral {
2121
2222class BrokenAlgoLiteral extends ShortStringLiteral {
2323 BrokenAlgoLiteral ( ) {
24- getValue ( ) .regexpMatch ( algorithmBlacklistRegex ( ) ) and
24+ getValue ( ) .regexpMatch ( getInsecureAlgorithmRegex ( ) ) and
2525 // Exclude German and French sentences.
2626 not getValue ( ) .regexpMatch ( ".*\\p{IsLowercase} des \\p{IsLetter}.*" )
2727 }
Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ class InsecureAlgoLiteral extends ShortStringLiteral {
2525 // Algorithm identifiers should be at least two characters.
2626 getValue ( ) .length ( ) > 1 and
2727 exists ( string s | s = getLiteral ( ) |
28- not s .regexpMatch ( algorithmWhitelistRegex ( ) ) and
28+ not s .regexpMatch ( getSecureAlgorithmRegex ( ) ) and
2929 // Exclude results covered by another query.
30- not s .regexpMatch ( algorithmBlacklistRegex ( ) )
30+ not s .regexpMatch ( getInsecureAlgorithmRegex ( ) )
3131 )
3232 }
3333}
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ string getAnInsecureHashAlgorithmName() {
112112private string rankedAlgorithmBlacklist ( int i ) {
113113 // In this case we know these are being used for encryption, so we want to match
114114 // weak hash algorithms too.
115- result = rank [ i ] ( string s | s = algorithmBlacklist ( ) or s = hashAlgorithmBlacklist ( ) )
115+ result = rank [ i ] ( string s | s = getAnInsecureAlgorithmName ( ) or s = getAnInsecureHashAlgorithmName ( ) )
116116}
117117
118118private string algorithmBlacklistString ( int i ) {
@@ -144,7 +144,7 @@ string getASecureAlgorithmName() {
144144 result = "ECIES"
145145}
146146
147- private string rankedAlgorithmWhitelist ( int i ) { result = rank [ i ] ( algorithmWhitelist ( ) ) }
147+ private string rankedAlgorithmWhitelist ( int i ) { result = rank [ i ] ( getASecureAlgorithmName ( ) ) }
148148
149149private string algorithmWhitelistString ( int i ) {
150150 i = 1 and result = rankedAlgorithmWhitelist ( i )
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ import default
22import semmle.code.java.security.Encryption
33
44from StringLiteral s
5- where s .getLiteral ( ) .regexpMatch ( algorithmBlacklistRegex ( ) )
5+ where s .getLiteral ( ) .regexpMatch ( getInsecureAlgorithmRegex ( ) )
66select s
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ import default
22import semmle.code.java.security.Encryption
33
44from StringLiteral s
5- where s .getLiteral ( ) .regexpMatch ( algorithmWhitelistRegex ( ) )
5+ where s .getLiteral ( ) .regexpMatch ( getSecureAlgorithmRegex ( ) )
66select s
You can’t perform that action at this time.
0 commit comments