cpp: model BDE bdlbb::Blob byte-buffer taint flow - #13
anurag6569201 wants to merge 1 commit into
Conversation
Source PR: github#22455 Source head: 9559357
✅ Shipwright · ApproveRecommendation: approve PR #13 · Tier
Findings (6)
Fireworks usage: 18,913 input · 735 output · 19,648 total tokens · $0.0046 · 13s · 0 fix iteration(s) Open the Shipwright check for full evidence and the audit bundle. Use |
| pack: codeql/cpp-all | ||
| extensible: summaryModel | ||
| data: # namespace, type, subtypes, name, signature, ext, input, output, kind, provenance | ||
| # Accessor chain |
There was a problem hiding this comment.
Shipwright · HIGH
The model file uses empty signatures for Blob::buffer, BlobBuffer::data, BlobBuffer::buffer, and getContiguousRangeOrCopy.
Impact: The model file uses empty signatures for Blob::buffer, BlobBuffer::data, BlobBuffer::buffer, and getContiguousRangeOrCopy. This makes the model match any overload or future overload with the same name, and gives a reader no way to tell which API surface is actually covered without cross-referencing the test stubs.
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
| - ["BloombergLP::bdlbb", "BlobBuffer", true, "data", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] | ||
| - ["BloombergLP::bdlbb", "BlobBuffer", true, "buffer", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] | ||
| # BlobUtil read-out | ||
| - ["BloombergLP::bdlbb", "BlobUtil", true, "copy", "(char *,const Blob &,int,int)", "", "Argument[*1]", "Argument[*0]", "taint", "manual"] |
There was a problem hiding this comment.
Shipwright · HIGH
The model for BlobUtil::getContiguousRangeOrCopy has two entries with the same empty signature, one mapping Argument[*1] to Argument[*0] and one mapping Argument[*1] to ReturnValue
Impact: The model for BlobUtil::getContiguousRangeOrCopy has two entries with the same empty signature, one mapping Argument[*1] to Argument[*0] and one mapping Argument[1] to ReturnValue[]. If the real function returns a pointer into the blob when the buffer is contiguous and copies into dstBuffer otherwise, the unconditional Argument[*1] -> Argument[*0] summary will propagate taint to dstBuffer even when the function…
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
| - ["BloombergLP::bdlbb", "Blob", true, "buffer", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] | ||
| - ["BloombergLP::bdlbb", "BlobBuffer", true, "data", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] | ||
| - ["BloombergLP::bdlbb", "BlobBuffer", true, "buffer", "", "", "Argument[-1]", "ReturnValue[*]", "taint", "manual"] | ||
| # BlobUtil read-out |
There was a problem hiding this comment.
Shipwright · HIGH
The BlobUtil::copy overload taking (char *,const Blob &,int,int) is modeled as Argument[*1] -> Argument[*0] with no length or position constraints.
Impact: The BlobUtil::copy overload taking (char *,const Blob &,int,int) is modeled as Argument[*1] -> Argument[*0] with no length or position constraints. A caller that copies only a zero-length or out-of-range slice will still have the entire destination buffer marked tainted, which can create misleading flows in code that partially initializes a buffer.
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
| - ["BloombergLP::bdlbb", "BlobUtil", true, "copy", "(char *,const Blob &,int,int)", "", "Argument[*1]", "Argument[*0]", "taint", "manual"] | ||
| - ["BloombergLP::bdlbb", "BlobUtil", true, "getContiguousRangeOrCopy", "", "", "Argument[*1]", "Argument[*0]", "taint", "manual"] | ||
| - ["BloombergLP::bdlbb", "BlobUtil", true, "getContiguousRangeOrCopy", "", "", "Argument[*1]", "ReturnValue[*]", "taint", "manual"] | ||
| # BlobUtil write-in |
There was a problem hiding this comment.
Shipwright · HIGH
The model marks BlobUtil::copy(Blob *,int,const char *,int) as Argument[*2] -> Argument[*0] with no sanitization or length validation.
Impact: The model marks BlobUtil::copy(Blob *,int,const char *,int) as Argument[*2] -> Argument[*0] with no sanitization or length validation. This treats any caller-supplied source buffer as fully tainted into the destination blob, which is appropriate for taint tracking but will flag every write path, including internal buffer initialization, as attacker-controlled unless downstream models add sanitizers.
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
| sink(*p); // $ ir | ||
| } | ||
|
|
||
| // The get() step comes from the built-in smart pointer model, not from bdlbb.model.yml. |
There was a problem hiding this comment.
Shipwright · LOW
The test stubs declare BlobBuffer::buffer() returning bsl::shared_ptr<char>&, but the model comment says the get() step comes from the built-in smart pointer model.
Impact: The test stubs declare BlobBuffer::buffer() returning bsl::shared_ptr<char>&, but the model comment says the get() step comes from the built-in smart pointer model. A new contributor cannot tell from the test file alone why the shared_ptr path is expected to work or whether the non-const overload is intentionally covered.
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
| | Dubious signature "(BN_MONT_CTX *,const BIGNUM *,int,const unsigned char *,size_t,uint32_t,uint32_t)" in summary model. | | ||
| | Dubious signature "(BN_RECP_CTX *,const BIGNUM *,BN_CTX *)" in summary model. | | ||
| | Dubious signature "(BUF_MEM *,size_t)" in summary model. | | ||
| | Dubious signature "(Blob *,int,const Blob &,int,int)" in summary model. | |
There was a problem hiding this comment.
Shipwright · LOW
The validatemodels output now contains three new 'Dubious signature' warnings for the BlobUtil signatures.
Impact: The validatemodels output now contains three new 'Dubious signature' warnings for the BlobUtil signatures. These are expected for abbreviated C++ signatures, but they add noise to the validation baseline and should be acknowledged or suppressed so future real signature errors are not lost among expected warnings.
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
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.
Source merge-base:
b756a08cf59743b7e8483622202440e012a90662Source head:
9559357bc637f7d5531aeb3152ec472fb61aa3f3