-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Python: Fix attribute taint #7873
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
Conversation
In `x.arg = TAINTED_STRING` there is a store step to the attribute `arg` of `x`. In our taint modeling, we allow _any_ store step with the code below. This means that we also say there is a taint-step directly from `TAINTED_STRING` to `x` :| ```codeql // construction by literal // TODO: Not limiting the content argument here feels like a BIG hack, but we currently get nothing for free :| DataFlowPrivate::storeStep(nodeFrom, _, nodeTo) ```
Judging from the results from the internal experiment, I think this looks good 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically looks fine. Is this removed alert an FP in this context?
@@ -49,7 +49,7 @@ def __exit__(self, exc_type, exc, tb): | |||
def test_with_arg(): | |||
ctx = Context_arg(TAINTED_STRING) | |||
with ctx as tainted: | |||
ensure_tainted(tainted) # $ tainted | |||
ensure_tainted(tainted) # $ MISSING: tainted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually expected, I think, until we model __enter__
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed 👍
yes, that's a FP. The current path is: 1: ControlFlowNode for cert_file 2: [post store] ControlFlowNode for self 3: ControlFlowNode for Attribute() 4: ControlFlowNode for Fstring This PR means that we no longer treat the |
1 similar comment
yes, that's a FP. The current path is: 1: ControlFlowNode for cert_file 2: [post store] ControlFlowNode for self 3: ControlFlowNode for Attribute() 4: ControlFlowNode for Fstring This PR means that we no longer treat the |
Cool, thanks for showing the path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, always nice to see fixes like these.
Fixes #7786
Draft PR so we can gauge what the impact of this change is before merging it (and look for failing QL tests 😅)