feat(sensitive): settle failed handle-use reservations - #68
Draft
seonghobae wants to merge 7 commits into
Draft
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
This was referenced Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partial implementation of #10, stacked on PR #55.
Buyer/security gap
The active sensitive-handle stack can reserve an authoritative use before protected-value resolution, but a reservation must be compensatable only when the trusted broker proves that disclosure failed before any protected value left the broker boundary. A blind counter decrement would be unsafe because concurrent callers could compensate the wrong reservation, replay stale compensation against a later use, or try to settle a reservation against a different state instance with identical policy scope.
Dependency
This Draft is stacked on unchanged exact PR #55 head
8d3ccf0a3b99fd9789210dd9798b422431fab7d8and must remain Draft while #55/#53/#46 are active.TDD / RCA sequence
Test-only exact head
63798d38a35fa14e9b7f899f638eb8fdcf077d46established the missing tracked-reservation contract. The first production implementation used a monotonically increasingu64reservation sequence plus a syntheticNoneexhaustion state. Exact predecessor headadd3599bee784c58dfaa4275d17c477eaed781a9passed repository contracts, formatting, workspace tests, strict Clippy and rustdoc but failed exact coverage atbranches=495/496,lines=3666/3667,regions=4575/4576.The uncovered production branch was the private
next_reservation_sequence == Nonepath. Normal public use could exercise only the opposite branch; a private unit test could manufacture exhaustion, but LLVM instrumented that unit-test copy separately from the integration-test production copy. Keeping a synthetic unreachable production state merely to satisfy coverage would preserve the wrong design.The root-cause repair therefore removed the finite caller-independent sequence space. Reservations now use allocation-bound, non-copyable in-process identities. The state retains one strong reference while a reservation is outstanding and the returned token retains another. A surviving stale token therefore keeps its original allocation live, so a later reservation cannot alias it after compensation; if the stale token is dropped, it cannot be replayed. No caller-controlled identifier or serializable sequence is introduced.
Exact head
17bc00790e75424afd97c8a73800d9b16c766300then passed CI run31451682170. Current exact headaa46d982b2bf786fe297744ac99f88b6c4c5f4cfadditionally proves a reservation token from oneSensitiveHandleUseStatecannot commit or compensate another state instance even when both carry the same policy scope.Exact-head evidence
On unchanged exact head
aa46d982b2bf786fe297744ac99f88b6c4c5f4cfagainst unchanged prerequisite #55 head8d3ccf0a3b99fd9789210dd9798b422431fab7d8:31451963178: success;No predecessor-head result is transferred to the current head.
Implemented contract
Truth boundary
This lane does not resolve protected values, prove whether disclosure occurred, derive authenticated workload identity, provide cross-process/database transactionality, persist handle state, perform KMS/encryption, or create a complete trusted broker. Allocation identity is intentionally an in-process primitive, not a durable broker token. The future trusted broker must supply the authoritative fact that compensation is valid only before disclosure and place reserve/recheck/disclose/settle inside its own transactional or locking boundary.