Skip to content

Commit b1251f0

Browse files
committed
JS: invertCase -> toOtherCase
1 parent 3c9e743 commit b1251f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

javascript/ql/src/Security/CWE-178/CaseSensitiveMiddlewarePath.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import javascript
1616
* Converts `s` to upper case, or to lower-case if it was already upper case.
1717
*/
1818
bindingset[s]
19-
string invertCase(string s) {
19+
string toOtherCase(string s) {
2020
if s.regexpMatch(".*[a-z].*") then result = s.toUpperCase() else result = s.toLowerCase()
2121
}
2222

@@ -35,7 +35,7 @@ predicate isCaseSensitiveRegExp(RegExpTerm term) {
3535
const = term.getAChild*() and
3636
const.getValue().regexpMatch(".*[a-zA-Z].*") and
3737
not getEnclosingClass(const).getAChild().(RegExpConstant).getValue() =
38-
invertCase(const.getValue()) and
38+
toOtherCase(const.getValue()) and
3939
not const.getParent*() instanceof RegExpNegativeLookahead and
4040
not const.getParent*() instanceof RegExpNegativeLookbehind
4141
)
@@ -67,7 +67,7 @@ string getExampleString(RegExpTerm term) {
6767
string getCaseSensitiveBypassExample(RegExpTerm term) {
6868
exists(string example |
6969
example = getExampleString(term) and
70-
result = invertCase(example) and
70+
result = toOtherCase(example) and
7171
result != example // getting an example string is approximate; ensure we got a proper case-change example
7272
)
7373
}

0 commit comments

Comments
 (0)