Skip to content
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

DataFlow::PathGraph Module not Found in codeql #13540

Open
nam0netime opened this issue Jun 22, 2023 · 8 comments
Open

DataFlow::PathGraph Module not Found in codeql #13540

nam0netime opened this issue Jun 22, 2023 · 8 comments
Labels
question Further information is requested

Comments

@nam0netime
Copy link

DataFlow::PathGraph Module, not Found

When using codeql workspace and trying to use the following code to debug sink source

from MyTaintTrackingConfig cfg, ConstraintValidatorisValidMethod im, DataFlow::PartialPathNode source, DataFlow::PartialPathNode sink
where
cfg.hasPartialFlow(source, sink, _) and
source.getNode().asParameter() = im.getParameter(0)
select sink, source, sink, "Partial flow from unsanitized user data"

I receive error that DataFlow::PathGraph Module, not Found

@nam0netime nam0netime added the question Further information is requested label Jun 22, 2023
@nam0netime nam0netime changed the title General issue DataFlow::PathGraph Module not Found in codeql Jun 23, 2023
@nam0netime
Copy link
Author

Also DataFlow::PartialPathNode also show error

@owen-mc
Copy link
Contributor

owen-mc commented Jun 23, 2023

I think you need to add the line import DataFlow::PathGraph.

@nam0netime
Copy link
Author

image

For some reason my configuration of codeql does not have PartialPathNode in it code import path so it keep getting error

image

@owen-mc
Copy link
Contributor

owen-mc commented Jun 23, 2023

Try removing the import DataFlow::PathGraph on line 4. I don't think you should have that if you have import DataFlow::PartialPathGraph. (In case you don't know, hovering your mouse over the things with red squiggly lines underneath should give you an error message, which is sometimes helpful in figuring out what's wrong.)

@nam0netime
Copy link
Author

I try delete the "import DataFlow::PathGraph" and when hovering my mouse over the error the error still could not resolve module DataFlow::PartialPathGraph

@owen-mc
Copy link
Contributor

owen-mc commented Jun 23, 2023

Oh, I think I know what's going on. The DataFlow library has recently been re-written to use parameterized modules, and while a compatibility layer has been created for normal flow there isn't one for partial flow. There are two options:

  1. Base your work on a slightly older commit, say 3538cf89b9, which is the commit before the refactor was merged. Then partial flow should work as you expect.
  2. Convert your configuration to use the new API for DataFlow. It's pretty straightforward in most cases. I think all the java configurations have been converted now, in PRs like these: 1, 2, 3. Then partial flow should work - the only problem being that I don't think there is documentation for how to use it yet. I put a minimal working example in point 5 of this message that should be enough to get it working.

@nam0netime
Copy link
Author

thank you i try the new way and it worked but now I am wondering about AdditionalTaintStep for example how can it be integrated with the new syntax since there like no document about this

@owen-mc
Copy link
Contributor

owen-mc commented Jun 27, 2023

That is great that you have got it working.

We are working on documentation, but until it is available you can find out how to do most things by searching to see what the existing Java configurations do. For additional taint steps, the most common way to do this is to implement isAdditionalTaintStep in your module, like this. If you search you will find many other examples of this being used. If you are used to instead extending the class AdditionalTaintStep from semmle.code.java.dataflow.FlowSteps then that should work too. Here is an example of it being used.

@github github deleted a comment from RajeshPrameJagdeo0 Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants