cpp: model BDE bdlbb::Blob byte-buffer taint flow - #22455
Conversation
There was a problem hiding this comment.
Pull request overview
Adds BDE bdlbb::Blob taint-flow models for payload access and copying.
Changes:
- Models Blob and BlobBuffer accessors.
- Models BlobUtil copy operations.
- Adds external-model tests and release notes.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
cpp/ql/lib/ext/bdlbb.model.yml |
Defines flow summaries. |
cpp/ql/test/library-tests/dataflow/external-models/bdlbb.cpp |
Adds test stubs and cases. |
cpp/ql/test/library-tests/dataflow/external-models/flow.expected |
Updates expected flow results. |
cpp/ql/test/library-tests/dataflow/external-models/steps.expected |
Updates expected summary steps. |
cpp/ql/lib/change-notes/2026-08-27-bdlbb-blob-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.
| data: # namespace, type, subtypes, name, signature, ext, input, output, kind, provenance | ||
| # Accessor chain: a tainted blob taints its buffers, and a tainted buffer taints its bytes. | ||
| - ["BloombergLP::bdlbb", "Blob", true, "buffer", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] | ||
| - ["BloombergLP::bdlbb", "BlobBuffer", true, "data", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] |
There was a problem hiding this comment.
I think we at least want to add BlobBuffer::buffer() here. bsl::shared_ptr<char> seems out-of-scope.
jketema
left a comment
There was a problem hiding this comment.
Again only looked at this briefly.
| - ["BloombergLP::bdlbb", "BlobBuffer", true, "data", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] | ||
| # BlobUtil read-out: the source blob (Argument[*1]) taints the destination buffer (and the | ||
| # returned contiguous range). | ||
| - ["BloombergLP::bdlbb", "BlobUtil", true, "copy", "", "", "Argument[*1]", "Argument[*0]", "taint", "manual"] |
There was a problem hiding this comment.
Like in the case of the protobuf PR. I think you need to be more specific here, as there seem to be three variants of copy and the input argument can either be argument 1 or argument 2.
There was a problem hiding this comment.
Update to handle variant of copy in the model specs.
Add flow summaries for the BDE segmented byte buffer BloombergLP::bdlbb::Blob so taint reaches a blob's payload bytes: - Accessor chain: Blob::buffer taints the returned BlobBuffer, and BlobBuffer::data/buffer taint the bytes. - bdlbb::BlobUtil::copy and getContiguousRangeOrCopy propagate taint between a blob and a flat buffer in both directions. This unblocks blob-carried sources such as bmqa::Message::getData, whose payload was previously stranded on the opaque Blob object. Not a duplicate; the bdlbb namespace had no coverage. Verified with a BloombergLP::bdlbb-shaped stub in the dataflow external-models harness.
420d1c1 to
8701ce9
Compare
jketema
left a comment
There was a problem hiding this comment.
I would again reduce the amount of comments. Otherwise this LGTM.
| pack: codeql/cpp-all | ||
| extensible: summaryModel | ||
| data: # namespace, type, subtypes, name, signature, ext, input, output, kind, provenance | ||
| # Accessor chain: a tainted blob taints its buffers, and a tainted buffer taints its bytes. |
There was a problem hiding this comment.
| # Accessor chain: a tainted blob taints its buffers, and a tainted buffer taints its bytes. | |
| # Accessor chain |
| # BlobUtil read-out: the source blob (Argument[*1]) taints the destination buffer (and the | ||
| # returned contiguous range). |
There was a problem hiding this comment.
| # BlobUtil read-out: the source blob (Argument[*1]) taints the destination buffer (and the | |
| # returned contiguous range). | |
| # BlobUtil read-out |
| # BlobUtil write-in: the source (Argument[*2]) taints the destination blob. `copy` has two | ||
| # write-in overloads, one taking a raw byte buffer and one taking another blob as the source; | ||
| # each row pins the exact signature so the int offset/length arguments are never tainted. |
There was a problem hiding this comment.
| # BlobUtil write-in: the source (Argument[*2]) taints the destination blob. `copy` has two | |
| # write-in overloads, one taking a raw byte buffer and one taking another blob as the source; | |
| # each row pins the exact signature so the int offset/length arguments are never tainted. | |
| # BlobUtil write-in |
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * Added flow summaries for the BDE `bdlbb::Blob` segmented byte buffer (`BloombergLP::bdlbb`). Taint now flows from a blob to its bytes through the `Blob::buffer`/`BlobBuffer::data` accessor chain and through the `bdlbb::BlobUtil::copy` and `getContiguousRangeOrCopy` helpers, so a blob populated from untrusted input (for example a BlazingMQ message body read via `bmqa::Message::getData`) is tracked into the payload bytes. |
There was a problem hiding this comment.
I would again shorten this.
| * Added flow summaries for the BDE `bdlbb::Blob` segmented byte buffer (`BloombergLP::bdlbb`). Taint now flows from a blob to its bytes through the `Blob::buffer`/`BlobBuffer::data` accessor chain and through the `bdlbb::BlobUtil::copy` and `getContiguousRangeOrCopy` helpers, so a blob populated from untrusted input (for example a BlazingMQ message body read via `bmqa::Message::getData`) is tracked into the payload bytes. | |
| * Added flow summaries for the BDE `BloombergLP::bdlbb::Blob` segmented byte buffer. |
Add flow summaries for the BDE segmented byte buffer BloombergLP::bdlbb::Blob so taint reaches a blob's payload bytes:
This unblocks blob-carried sources such as bmqa::Message::getData, whose payload was previously stranded on the opaque Blob object. Not a duplicate; the bdlbb namespace had no coverage. Verified with a BloombergLP::bdlbb-shaped stub in the dataflow external-models harness.