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

Java: Add VS Code model editor queries #14199

Merged
merged 15 commits into from
Sep 28, 2023

Conversation

koesie10
Copy link
Member

@koesie10 koesie10 commented Sep 13, 2023

This adds two queries that support the CodeQL Model Editor feature in the CodeQL VS Code extension. These queries will be used to retrieve models that can be modeled using MaD. The query results they produce can also be converted to SARIF, hence the static strings in the query.

The ModelEditor.qll file's behavior is very similar to ExternalApi.qll, but they are used for completely different purposes, and changes to the ExternalApi.qll do not necessarily need to propagate to ModelEditor.qll.

These queries have been in use for a few weeks now in the VS Code extension (see java.ts). Using this, we have confirmed that these queries return the results we need. Once these queries are merged and released, we will switch to resolving the queries from the query packs. We will do so based on the tags.

@github-actions github-actions bot added the Java label Sep 13, 2023
@koesie10 koesie10 added the no-change-note-required This PR does not need a change note label Sep 13, 2023
@koesie10 koesie10 marked this pull request as ready for review September 13, 2023 13:17
@koesie10 koesie10 requested a review from a team as a code owner September 13, 2023 13:17
@aschackmull
Copy link
Contributor

The metadata should be fixed. Otherwise this looks fine, I think.

aschackmull
aschackmull previously approved these changes Sep 25, 2023
@koesie10
Copy link
Member Author

@aschackmull Thanks for the review! I've made one last change to make it in line with the C# query that splits the apiName column into 4 separate columns. This reduces the number of string concatenations and should reduce stress on the string pool. It doesn't change any of the other behavior.

@koesie10
Copy link
Member Author

I can successfully run DCA against these queries and the timings look to be reasonable for most projects. I've created a PR to add a new query suite to DCA: https://github.com/github/codeql-dca/pull/1673

@koesie10 koesie10 merged commit 10231e9 into main Sep 28, 2023
9 checks passed
@koesie10 koesie10 deleted the koesie10/add-java-model-editor-queries branch September 28, 2023 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants