-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: Add example queries #20776
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
base: main
Are you sure you want to change the base?
Rust: Add example queries #20776
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds three example CodeQL queries for Rust to help developers learn query writing. The examples demonstrate different query patterns, from simple AST matching to more complex taint tracking scenarios.
- Adds three example queries: empty-if, simple-sql-injection, and simple-constant-password
- Creates a new qlpack structure for Rust examples
- Updates documentation to include links to the new example queries
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rust/ql/src/change-notes/2025-11-07-example-queries.md | Documents the addition of the three new example queries |
| rust/ql/examples/snippets/empty_if.ql | Example query demonstrating basic AST pattern matching for empty if expressions |
| rust/ql/examples/snippets/simple_sql_injection.ql | Example query demonstrating taint tracking from user input to SQL query construction |
| rust/ql/examples/snippets/simple_constant_password.ql | Example query demonstrating taint tracking from string literals to password parameters |
| rust/ql/examples/qlpack.yml | Configuration file for the new rust-examples qlpack |
| rust/ql/examples/qlpack.lock.yml | Lock file for the rust-examples qlpack dependencies |
| docs/codeql/reusables/rust-further-reading.rst | Adds reference link to the new example queries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add example CodeQL queries for Rust, and link them from
rust-further-reading.rst- similarly to how we have in other languages. These should help developers who are trying to write their first Rust queries.