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.

Copy link
Contributor

@paldepind paldepind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These examples look great!

@@ -0,0 +1,4 @@
---
category: newQuery
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would've thought newQuery meant a new query meant for running by end users. Though I don't know what other category we could pick, so maybe this is the best option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the conclusion I came to. It felt more appropriate than minorAnalysis. I guess the main impact of this will be which part of the compiled change notes this part will appear in.

I'm not sure though, I'll request a docs review...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the ping. What are the available categories?

Co-authored-by: Simon Friis Vindum <paldepind@github.com>
@geoffw0 geoffw0 added the ready-for-doc-review This PR requires and is ready for review from the GitHub docs team. label Nov 11, 2025
@geoffw0
Copy link
Contributor Author

geoffw0 commented Nov 11, 2025

Docs team - this doesn't necessarily need a thorough review, the main content being three example queries targeting Rust that we're happy with. And a link to them from the docs in the same way as we do for other languages.

However we do have a question above about the change note that we'd appreciate your thoughts on.

Co-authored-by: Tom Hvitved <hvitved@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation ready-for-doc-review This PR requires and is ready for review from the GitHub docs team. Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants