Run query

Requirements to run a custom rules query

Run a query on a repository

Run queries against a repository from your Snyk Project list. The list contains repositories you previously uploaded to Snyk.

  1. Log in to the Snyk Web UI and go to your Group and Organization.

  2. Go to Custom rules.

  3. (Optional) in the Get Started panel, you have access to the following:

    • Query examples: Examples of highly requested queries.

    • Query Templates: Pre-built templates of logical operators, conditions, and other components.

    • Query Predicates: Predefined criteria and conditions to be included in the result.

  4. Go to Run query on a repository > Repositories and select a repo where you want to run the query. The repo is imported after you select it.

  5. (Optional) If a repository is already selected, click Select new repo to run the query.

  6. Write your query in the Code query panel with suggestive AI support.

  7. Run query.

For more information, see Query examples.

Run a query on a code snippet

Run queries against code snippets to detect vulnerabilities, review and audit code, and assess compliance and regulatory requirements.

  1. Log in to the Snyk Web UI and go to your Group and Organization.

  2. Go to Custom rules.

  3. Select Run query on a code snippet.

  4. Select the programming language from the dropdown list and paste your code in the code snippet area.

You can run queries only on certain languages in the code snippet area. See the dropdown menu for the full list of available languages.

Analyze query results

When you run a query, the results show the matching parts of the tested code, highlighting which parts of the code are related to the query. Each match is shown when Snyk Code is testing a repository and can be triaged based on the finding.

Last updated

More information

Snyk privacy policy

© 2023 Snyk Limited | All product and company names and logos are trademarks of their respective owners.