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
Python: Add taint-flow modeling for re module
#14725
base: main
Are you sure you want to change the base?
Conversation
In this case, wouldn't the right thing be to just remove the In my mind, |
|
I would go even further and add the lines where we do not expect taint under an |
Ruby uses 10 as their number. I considered doing the same, but didn't really care _too_ much about it 🤷 https://github.com/github/codeql/blob/14cfb82a8c16e15fadc006ae46331302f0341f63/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll#L636
Mostly to highlight that with flow-summary modeling, we don't expect taint for a lot of these. I aslo opted to make `finditer()` tainted for consistency.
|
Performance looks fine 👍 |
I ended up writing the tests first, and then did the modeling with flow-summaries instead of manually propagating flow to the object as we have been forced to do before.
I think overall it was nice to be able to write flow-summaries, although the lack of auto-completion when writing the input/output specs is a little annoying.
As a side effect of the way I worked, we do have some slightly funky test results, such as the one below -- Since we can say that only the first element of the tuple returned by
re.subnis tainted, we don't actually taint the whole returned tuple like we used to (I added that "feature" in a few places, but with a TODO notice).☝️ is more a note to reviewers why the tests look like they do, and that some of the
MISSINGannotations are actually fine... I wonder if we should remove those lines of the test though, to not confuese our future selves?(I recommend reviewing commit-by-commit)