Rust: Add command injection (CWE-078) and unsafe deserialization (CWE-502) queries - #22302
Rust: Add command injection (CWE-078) and unsafe deserialization (CWE-502) queries#22302lcmangalagiri wants to merge 1 commit into
Conversation
…-502) queries
Add two new security queries for Rust:
1. Command Injection (CWE-078):
- Detects user-controlled data flowing into std::process::Command and
tokio::process::Command (both command name and arguments)
- Includes models-as-data sinks for Command::new, .arg(), .args()
- Query ID: rust/command-line-injection
2. Unsafe Deserialization (CWE-502):
- Detects user-controlled data flowing into deserialization functions
(serde_json, bincode, rmp_serde, ciborium, serde_yaml, toml)
- Query ID: rust/unsafe-deserialization
Both queries include:
- Extension libraries with sources, sinks, and barriers
- Query help (.qhelp) with examples
- Test cases with inline expectations
- Models-as-data sink definitions
|
Initial thoughts:
I'm guessing much of this was generated by Copilot or a similar tool, with some human review / guidance / iteration. Please correct me if my assumption is wrong. What kind of verification have you done? Are there any areas you're less confident about. How were the Also please could you split this pull request in two - one PR for each query. That should help review and will prevent one query from holding up the other. |
|
Yes. Code Comments, formatting and documentation are validated and auto-generated using tooling with thorough human review iterations from my end. Also please find the below requested answers for your reference:
a) Area: .expected files missing
I copied the values from equivalent queries (rust/command-line-injection, rust/unsafe-deserialization) in other languages. |
Summary
Add two new security queries for Rust, which currently has no experimental queries.
Command Injection (CWE-078):
Unsafe Deserialization (CWE-502):
Both queries include: