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

QL4QL: Add DependencyPath.ql query #11081

Merged
merged 2 commits into from Nov 3, 2022
Merged

Conversation

asgerf
Copy link
Contributor

@asgerf asgerf commented Nov 2, 2022

Adds an explorative query for visualising how a given predicate/class/file depends on a given predicate or class.

By "explorative" I mean it's not intended to run in CI. It's a query you have to adapt to your needs and run locally.

Dependencies introduced by magic are not known to the query.

To use the query:

  • Build the QL4QL extractor and extract a database for the relevant CodeQL library
  • Modify ql/src/queries/explore/DependencyPath.ql and run it

For example, here I ran it to answer how RE::RegExpTerm depends on isLocalSource:

dependency-path-sloww


from PathNode source, PathNode sink
where hasFlowPath(source, sink)
select source, source, sink, "$@ depends on $@.", source, source.toString(), sink, sink.toString()

Check warning

Code scanning / CodeQL

Alert message style violation Warning

Don't repeat the alert location as a link.
Copy link
Contributor Author

@asgerf asgerf Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't fix. For this particular query, it really does help visually that both source and sink are rendered the same way.

ql/ql/src/queries/explore/DependencyPath.ql Fixed Show fixed Hide fixed
ql/ql/src/queries/explore/DependencyPath.ql Fixed Show fixed Hide fixed
@asgerf asgerf marked this pull request as ready for review Nov 2, 2022
@asgerf asgerf requested a review from a team as a code owner Nov 2, 2022
erik-krogh
erik-krogh previously approved these changes Nov 2, 2022
Copy link
Contributor

@erik-krogh erik-krogh left a comment

Nice 👍
I see you're using your new key-bindings.

LGTM.

@asgerf asgerf merged commit 8502939 into github:main Nov 3, 2022
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants