feat(confidential): refuse a stream handle in a confidential body - #13
Conversation
…connection.rs,crates/tinybus/sr Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
Warning Review limit reached
Next review available in: 117 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The gap this closes
A confidential call is delivered only to a loaded, hash-verified module
(PR #10). A bulk stream does not travel in that call. The call carries a
StreamRefhandle; the bytes travel afterwards as their ownStream.Writecalls, which carry no
confidentialflag and are routed without an attestationcheck.
So this compiled, ran, and looked right — while sending the payload unattested:
The attestation work shipped with that documented as a known limitation. This
turns it from a silent trap into a loud error:
Why this is a sender-side rule and not a broker check
The broker cannot enforce this, and must not try. Spotting a handle means
reading the body, and a broker that reads a confidential body is precisely what
the flag exists to prevent — the same invariant behind the
BUS_NAMEfix inPR #10.
It is enforced in
Connection::call_raw, the one chokepoint every confidentialsend passes through, inside the sending peer's own process — which already
owns the body it just built. That covers both
Proxy::call_confidentialandhand-built messages. It deliberately is not in
Message::validate(), whichthe broker calls on ingress and which would inherit the same problem.
The check runs only when
confidentialis set, so ordinary traffic paysnothing.
Detection, and the tradeoff it makes
Stream ids are documented as opaque ("Never parse it"), so detection cannot key
off the
s{n}prefix a future implementation might not use. It is structuralinstead: a detection-only mirror struct with
deny_unknown_fieldsmatches anobject whose keys are exactly a
StreamRef's withidpresent, recursingthrough arrays and nested objects so a handle buried in a struct is still found.
The cost, stated plainly: a bare
{"id": "…"}in a confidential body isrefused even when it was never a stream handle. That is the deliberate direction
to be wrong in — the false positive is loud, local, and fixed by restructuring
the call, whereas the false negative is a secret leaving unattested and nobody
finding out.
What this does not do
It does not make bulk transfer confidential. A secret large enough to want a
stream still has no attested way to travel; that is its own piece of work. This
only removes the silent version of the gap.
Tests
idalongside other fields, a bare string, a non-stringid,an empty body,
null.call_confidentialto a genuinely attested recipient isrefused, while the same handle in a non-confidential call is not intercepted.
Gate
cargo fmt --all -- --checkclean;cargo clippy --locked --all-targets --all-features -- -D warningszero warnings;cargo test --locked --all-features294 passed;cargo check --locked --no-default-featurescompiles. The opt-in real-module tests were also run against built cdylibs
(8 passed).
Note on provenance
This work was written while PR #10 was still open and pushed to its branch
moments after that PR merged, so it was stranded there rather than landing. It
is unchanged apart from being rebased onto current
main, where it appliescleanly.