Skip to content

Conversation

@geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Nov 7, 2025

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.

Copilot AI review requested due to automatic review settings November 7, 2025 16:56
@geoffw0 geoffw0 requested review from a team as code owners November 7, 2025 16:56
@geoffw0 geoffw0 added the Rust Pull requests that update Rust code label Nov 7, 2025
Copy link
Contributor

Copilot AI left a 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.

from IfExpr ifExpr
where
// where the 'then' branch is empty
ifExpr.getThen().(BlockExpr).getStmtList().getNumberOfStmtOrExpr() = 0 and

Check warning

Code scanning / CodeQL

Redundant cast Warning

Redundant cast to
BlockExpr
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant