Skip to content

C++: Support SQL Injection sinks for Oracle Call Interface (OCI) #19832

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ebickle
Copy link
Contributor

@ebickle ebickle commented Jun 20, 2025

Fixes #19764

  • Allow queries to be extended using a new sql-injection Models as Data (MaD) sink kind for C/C++.
  • Add sql-injection sink models for the Oracle Call Interface (OCI) database library functions OCIStmtPrepare and OCIStmtPrepare2.

@Copilot Copilot AI review requested due to automatic review settings June 20, 2025 13:08
@ebickle ebickle requested a review from a team as a code owner June 20, 2025 13:08
Copy link
Contributor

@Copilot 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 introduces support for SQL injection sinks for Oracle Call Interface (OCI) in C/C++ by adding models for the OCIStmtPrepare and OCIStmtPrepare2 functions. Key changes include:

  • Adding OCI function prototypes and test cases in test.c to trigger both vulnerable (BAD) and safe (GOOD) patterns.
  • Updating expected taint flow edges in the SqlTainted.expected file.
  • Extending the CodeQL model through modifications in SqlTainted.ql, Oracle.oci.model.yml, and change notes documentation.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cpp/ql/test/query-tests/Security/CWE/CWE-089/SqlTainted/test.c Added OCI function prototypes and test cases for OCIStmtPrepare and OCIStmtPrepare2 including taint tracking for SQL injection.
cpp/ql/test/query-tests/Security/CWE/CWE-089/SqlTainted/SqlTainted.expected Updated expected taint flow edge definitions to include new OCI models.
cpp/ql/src/change-notes/2025-06-20-sql-injection-models.md Documented extension of sql-injection sink support through Models as Data.
cpp/ql/src/Security/CWE/CWE-089/SqlTainted.ql Enhanced sink configuration to include the new "sql-injection" model.
cpp/ql/lib/ext/Oracle.oci.model.yml Added sink models for OCIStmtPrepare and OCIStmtPrepare2 functions with sql-injection kind.
cpp/ql/lib/change-notes/2025-06-20-oracle-oci-models.md Documented the addition of OCI sql-injection sink models.

}

// Oracle Call Interface (OCI) Routines
int OCIStmtPrepare(
Copy link
Preview

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider moving the Oracle OCI function prototypes to a dedicated header file to improve maintainability and reduce duplication in test code.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Oracle Call Interface (OCI) to C/C++ coverage
1 participant