Skip to content

Commit dcb7324

Browse files
committed
Add the constraint that the caller method must throw an exception
1 parent a83f9ce commit dcb7324

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

java/ql/src/experimental/Security/CWE/CWE-600/UncaughtServletException.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ class UncaughtServletExceptionSink extends DataFlow::ExprNode {
4848
UncaughtServletExceptionSink() {
4949
exists(Method m, MethodAccess ma | ma.getMethod() = m |
5050
isServletMethod(ma.getEnclosingCallable()) and
51+
exists(m.getAThrownExceptionType()) and // The called method might plausibly throw an exception.
5152
ma.getAnArgument() = this.getExpr() and
5253
not exists(TryStmt t |
53-
t.getBlock() = ma.getEnclosingStmt().getEnclosingStmt*() and
54+
t.getBlock() = ma.getAnEnclosingStmt() and
5455
exceptionIsCaught(t, m.getAThrownExceptionType())
5556
)
5657
)

0 commit comments

Comments
 (0)