-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Java: Add support for data flow through thrown exceptions. #9914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll
Fixed
Show fixed
Hide fixed
java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll
Fixed
Show fixed
Hide fixed
Will this also fix #3710? |
Excellent question. I am indeed introducing dedicated data flow nodes corresponding to variable declarations in catch clauses along with (among others) the outgoing edges you ask for in the issue. However, I was not initially planning to expose those nodes, as I hadn't yet imagined use-cases. Do you think it is useful to be able to e.g. declare such a variable declaration as a source in the way that you do in the issue? With the changes in this PR I'd hoped that you didn't need to. |
3357eba
to
50b9339
Compare
#3710 was originally created in response to the "Step 3: Errors and Exceptions" part of https://securitylab.github.com/ctf/codeql-and-chill/. try {
parse(tainted);
} catch (Exception e) {
sink(e.getMessage())
} The goal was to catch flow from |
Yes. In the context of this PR, the way to do that would be to make |
da1418b
to
a194ebf
Compare
a194ebf
to
ee05379
Compare
ee05379
to
f41c626
Compare
f41c626
to
2746f3f
Compare
2d779f3
to
9d8e5b9
Compare
9d8e5b9
to
533a57e
Compare
533a57e
to
b0ff1da
Compare
This adds support for exception flow.
A test is included that shows some of what works and what doesn't.
Currently we get spurious flow due to imprecisions in type pruning.Mostly fixed now.There's also some missing, since I've ignored MaD-synthesised method bodies for now.