Run query
Conditions
If you re-imported Projects in Snyk, you need to Select new repo in Custom rules or wait for the next automated scan cycle. 🔗 Re-importing existing repositories for the Snyk Code test
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.
Open Snyk Web UI and go to your Group and Organization.
Go to Custom rules.
(Optional) in the Get Started panel, you can access 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.
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.
(Optional) If a repository is already selected, click Select new repo to run the query.
Write your query in the Code query panel with suggestive AI support.
Writing a query Run query.
(Optional) Save the custom rule you created.
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.
Open Snyk Web UI and go to your Group and Organization.
Go to Custom rules.
Select Run query on a code snippet.
Select the programming language from the dropdown list and paste your code inside.

(Optional) Save the custom rule you created.
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 testing a repository and can be triaged per finding.
Last updated
Was this helpful?