mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Fix conditionControlsMethod predicate
Exceptions for throw and return statements were missing the appropriate condition
This commit is contained in:
@@ -17,8 +17,8 @@ predicate conditionControlsMethod(MethodAccess ma, Expr e) {
|
||||
cb.controls(ma.getBasicBlock(), cond) and
|
||||
not cb.controls(any(SensitiveExecutionMethod sem).getAReference().getBasicBlock(),
|
||||
cond.booleanNot()) and
|
||||
not cb.controls(any(ThrowStmt t).getBasicBlock(), _) and
|
||||
not cb.controls(any(ReturnStmt r).getBasicBlock(), _) and
|
||||
not cb.controls(any(ThrowStmt t).getBasicBlock(), cond.booleanNot()) and
|
||||
not cb.controls(any(ReturnStmt r).getBasicBlock(), cond.booleanNot()) and
|
||||
e = cb.getCondition()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@ class ConditionalBypassTest {
|
||||
|
||||
public static void test7(String user, String password) {
|
||||
Cookie adminCookie = getCookies()[0];
|
||||
// FALSE NEGATIVE: login is bypasseable
|
||||
if (adminCookie.getValue() == "false") { // $ MISSING: $ hasConditionalBypassTest
|
||||
// BAD: login is bypasseable
|
||||
if (adminCookie.getValue() == "false") { // $ hasConditionalBypassTest
|
||||
login(user, password);
|
||||
return;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user