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

Including All Query Results in .sarif File #15815

Open
marktefftech opened this issue Mar 5, 2024 · 1 comment
Open

Including All Query Results in .sarif File #15815

marktefftech opened this issue Mar 5, 2024 · 1 comment
Labels
question Further information is requested

Comments

@marktefftech
Copy link

marktefftech commented Mar 5, 2024

Currently we can only use @kind problem and @kind path-problem queries with query suites. Other queries need to be run manually and they end up in a separate format (.bqrs and not .sarif).

  1. There's a difference in exporting results from the UI in vscode. If you right click on a row in the query history, this is what you see for a raw query:

image

This is what you see for a path-problem query:

image

Notice the "View Alerts (SARIF)" option

  1. You can directly run a CodeQL query like this:

    codeql database analyze ~/codeql-dbs/<db>/ queries/SampleFile.ql --format=sarif-latest --output=results.sarif
    

    However, with the output format set to sarif, we get this error:

    A fatal error occurred: Could not process query metadata for 
    ~/path/to/codeql-dbs/<db>/ queries/SampleFile.ql
    Error was: Cannot process query metadata for a query without the '@kind' metadata property. To learn more, see 
    https://codeql.github.com/docs/writing-codeql-queries/metadata-for-codeql-queries/ [NO_KIND_SPECIFIED]
    

    This error happens after we have the BQRS, the tool is just saying it can't convert the BQRS to a SARIF.

Is it possible to include all query results in the sarif file?

Thanks in advance

@marktefftech marktefftech added the question Further information is requested label Mar 5, 2024
@marktefftech
Copy link
Author

Edit: Added screenshots and example query commands

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

1 participant