Skip to content

Commit e89d8e2

Browse files
authored
Merge pull request #14907 from MathiasVP/remove-workaround-in-authentication-bypass
C++: Remove workaround for negated conditions in `cpp/user-controlled-bypass`
2 parents 0433821 + a7d820c commit e89d8e2

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

cpp/ql/src/Security/CWE/CWE-290/AuthenticationBypass.ql

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ predicate useOfHardCodedAddressOrIP(Expr use) {
4848
)
4949
}
5050

51-
Expr getExprWithoutNot(Expr expr) {
52-
result = expr and not expr instanceof NotExpr
53-
or
54-
result = getExprWithoutNot(expr.(NotExpr).getOperand()) and expr instanceof NotExpr
55-
}
56-
5751
/**
5852
* Find `IfStmt`s that have a hard-coded IP or web address in
5953
* their condition. If the condition also depends on an
@@ -65,7 +59,7 @@ predicate hardCodedAddressInCondition(Expr subexpression, Expr condition) {
6559
// One of the sub-expressions of the condition is a hard-coded
6660
// IP or web-address.
6761
exists(Expr use | use = condition.getAChild+() | useOfHardCodedAddressOrIP(use)) and
68-
condition = getExprWithoutNot(any(IfStmt ifStmt).getCondition())
62+
condition = any(IfStmt ifStmt).getCondition()
6963
}
7064

7165
predicate isSource(FS::FlowSource source, string sourceType) {

0 commit comments

Comments
 (0)