JS: Exclude some sinks in UnvalidatedDynamicMethodCall

This commit is contained in:
Asger F
2025-01-06 10:32:11 +01:00
parent 7e4fbe2f14
commit 4c9f406e34

View File

@@ -182,7 +182,11 @@ module UnvalidatedDynamicMethodCall {
exists(InvokeExpr invk |
this = invk.getCallee().flow() and
// don't flag invocations inside a try-catch
not invk.getASuccessor() instanceof CatchClause
not invk.getASuccessor() instanceof CatchClause and
// Filter out `foo.bar()` calls as they usually aren't interesting.
// Technically this could be reachable if preceded by `foo.bar = obj[taint]`
// but such sinks are more likely to be FPs and also slow down the query.
not invk.getCallee() instanceof DotExpr
)
}