I'm having trouble tracking variable propagation #892
Replies: 2 comments 1 reply
-
|
Hi I know that for other languages, when the taint source happens inside a constructor or a field initializer, like in your example above, and there is not explicit call to the constructor follow by a call to the method containing the sink, then we will not flag it. I suspect the same happens for Python. It is on our radar to fix. |
Beta Was this translation helpful? Give feedback.
-
|
The issue has two parts. Here's how to solve both with custom predicate fieldToAttributeRead(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) { 3. For "permissive but not actual taint" analysis predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) { This propagates from any string method receiver to its return value, which is exactly what you need for "I just want to trace propagation without strict taint semantics." @Light1Smile acept me |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm having trouble tracking variable propagation.
I'm writing a CodeQL query to help me trace how a model flows through a program. However, I found that using data flow analysis or taint tracking doesn't work very well in this case.
Here's my query:
For the following code, it fails to properly track the flow of "ssube/stable-diffusion-x4-upscaler-onnx". This string is first passed to hub_checkpoint, and then by default, if test_pipeline_default_ddpm is used, it gets passed to self.hub_checkpoint. However, when I try to perform a data flow or taint analysis with "ssube/stable-diffusion-x4-upscaler-onnx" as the source and self.hub_checkpoint (the first argument to OnnxStableDiffusionUpscalePipeline.from_pretrained) as the sink, CodeQL fails to connect them effectively.
I understand that this might require taint tracking and defining isAdditionalFlowStep, but I haven't found any detailed tutorials related to this, so I'm not sure how to improve the query. Could anyone offer some suggestions?
Secondly, when a string is treated as tainted and then processed by some method, it is not propagated by default. For example, in the code below, if I want to make the taint propagation more permissive—so that passing through method parameters or method calls still allows propagation—how can I do that?—because in some cases I only want to analyze the propagation rather than treating it as actual taint, what should I do?
I would be most grateful if someone could offer help:)
Beta Was this translation helpful? Give feedback.
All reactions