File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
javascript/ql/src/Security/CWE-178 Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import javascript
16
16
* Converts `s` to upper case, or to lower-case if it was already upper case.
17
17
*/
18
18
bindingset [ s]
19
- string invertCase ( string s ) {
19
+ string toOtherCase ( string s ) {
20
20
if s .regexpMatch ( ".*[a-z].*" ) then result = s .toUpperCase ( ) else result = s .toLowerCase ( )
21
21
}
22
22
@@ -35,7 +35,7 @@ predicate isCaseSensitiveRegExp(RegExpTerm term) {
35
35
const = term .getAChild * ( ) and
36
36
const .getValue ( ) .regexpMatch ( ".*[a-zA-Z].*" ) and
37
37
not getEnclosingClass ( const ) .getAChild ( ) .( RegExpConstant ) .getValue ( ) =
38
- invertCase ( const .getValue ( ) ) and
38
+ toOtherCase ( const .getValue ( ) ) and
39
39
not const .getParent * ( ) instanceof RegExpNegativeLookahead and
40
40
not const .getParent * ( ) instanceof RegExpNegativeLookbehind
41
41
)
@@ -67,7 +67,7 @@ string getExampleString(RegExpTerm term) {
67
67
string getCaseSensitiveBypassExample ( RegExpTerm term ) {
68
68
exists ( string example |
69
69
example = getExampleString ( term ) and
70
- result = invertCase ( example ) and
70
+ result = toOtherCase ( example ) and
71
71
result != example // getting an example string is approximate; ensure we got a proper case-change example
72
72
)
73
73
}
You can’t perform that action at this time.
0 commit comments