Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The models match the documented API signatures and are covered by focused regression cases.
Pull request overview
Adds Comdb2 C API SQL-execution sinks to C++ SQL-injection analysis.
Changes:
- Models SQL arguments for both Comdb2 execution functions.
- Adds regression coverage and a change note.
File summaries
| File | Description |
|---|---|
cpp/ql/lib/ext/Comdb2.model.yml |
Defines Comdb2 SQL-injection sinks. |
cpp/ql/test/query-tests/Security/CWE/CWE-089/SqlTainted/test_comdb2.c |
Tests unsafe SQL and safe parameter binding. |
cpp/ql/test/query-tests/Security/CWE/CWE-089/SqlTainted/SqlTainted.expected |
Updates generated expected results. |
cpp/ql/lib/change-notes/2026-09-14-comdb2-sql-injection.md |
Documents the analysis improvement. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calls that execute user-controlled SQL through the Comdb2 C API are currently missing SQL-injection sinks. Model the SQL-text argument of
cdb2_run_statementandcdb2_run_statement_typedsocpp/sql-injectionreports these flows. The typed variant specifies result-column types and still interprets its SQL argument as query text.The models follow the public C API documentation and public Apache-2.0-licensed declarations. Regression coverage includes both unsafe execution calls, constant SQL, and tainted bound values used with constant parameterized SQL. Includes a library change note.
Validation with CodeQL CLI 2.25.6:
cpp/ql/test/query-tests/Security/CWE/CWE-089/SqlTainted).cpp/ql/test/library-tests/dataflow/external-models/validatemodels.ql).