cpp: model BDE bslx in-stream deserialization taint flow - #22453
Conversation
There was a problem hiding this comment.
Pull request overview
Adds C++ taint-flow models for Bloomberg BDE bslx deserialization.
Changes:
- Models
ByteInStream,GenericInStream, andbdexStreamIn. - Covers scalar, string, array, reset, and fluent-call flows.
- Adds comprehensive external-model tests and release notes.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
cpp/ql/lib/ext/bslx.model.yml |
Defines the new flow summaries. |
cpp/ql/test/library-tests/dataflow/external-models/bslx.cpp |
Exercises modeled APIs and chaining. |
cpp/ql/test/library-tests/dataflow/external-models/flow.expected |
Updates generated flow expectations. |
cpp/ql/test/library-tests/dataflow/external-models/steps.expected |
Updates generated summary-step expectations. |
cpp/ql/lib/change-notes/2026-08-27-bslx-models.md |
Documents the analysis improvement. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Add flow summaries for the BDE byte-stream deserializers in BloombergLP::bslx: - ByteInStream and GenericInStream<STREAMBUF>: constructing (or, for ByteInStream, reset-ing) from a buffer/streambuf taints the stream, and every get* method propagates that taint into its output variable. get* returns *this, so a fluent row keeps chained calls tainted. - InStreamFunctions::bdexStreamIn: the generic BDEX entry point that populates any bdex-compatible object from a stream, modeled as stream -> object. Not a duplicate of the bsl.* container models or the std/bsl QL models, which cover only the bsl standard-library-alike types; the bslx BDE namespace had no coverage. Verified with a BloombergLP::bslx-shaped stub in the dataflow external-models harness.
77a4275 to
ad27014
Compare
| - ["BloombergLP::bslx", "ByteInStream", true, "getInt16", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"] | ||
| - ["BloombergLP::bslx", "ByteInStream", true, "getUint16", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"] | ||
| - ["BloombergLP::bslx", "ByteInStream", true, "getInt24", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"] | ||
| - ["BloombergLP::bslx", "ByteInStream", true, "getUint24", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"] |
There was a problem hiding this comment.
We generally do not define taint tracking models where the output in an integer, as in most of our queries we sanitize taint flow through integers. So, I think we should drop models like these (not the the models that specify ReturnValue[*] as output though). Unless you have a specific use-case for them.
C/C++ has a slight exception: for value preserving dataflow, we might want to have relevant summary models, as this would allow flag up more array out-of-bounds issues. However, that does not apply here as the best you can have here is taint.
Add flow summaries for the BDE byte-stream deserializers in BloombergLP::bslx:
Not a duplicate of the bsl.* container models or the std/bsl QL models, which cover only the bsl standard-library-alike types; the bslx BDE namespace had no coverage.