C++: Remove workaround for negated conditions in 'cpp/user-controlled-bypass'.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-11-24 15:17:45 +00:00
parent e438671846
commit a7d820ce62

View File

@@ -48,12 +48,6 @@ predicate useOfHardCodedAddressOrIP(Expr use) {
)
}
Expr getExprWithoutNot(Expr expr) {
result = expr and not expr instanceof NotExpr
or
result = getExprWithoutNot(expr.(NotExpr).getOperand()) and expr instanceof NotExpr
}
/**
* Find `IfStmt`s that have a hard-coded IP or web address in
* their condition. If the condition also depends on an
@@ -65,7 +59,7 @@ predicate hardCodedAddressInCondition(Expr subexpression, Expr condition) {
// One of the sub-expressions of the condition is a hard-coded
// IP or web-address.
exists(Expr use | use = condition.getAChild+() | useOfHardCodedAddressOrIP(use)) and
condition = getExprWithoutNot(any(IfStmt ifStmt).getCondition())
condition = any(IfStmt ifStmt).getCondition()
}
predicate isSource(FS::FlowSource source, string sourceType) {