Repository navigation
fix(golang): wipe guest buffers on failed placement and close stashgen's engine - #1550
Draft
cipherstash-agent wants to merge 1 commit into
Draft
cipherstash-agent wants to merge 1 commit into
cipherstash-agent wants to merge 1 commit into
Conversation
…n's engine place and placeAuth left the data in a registered guest buffer when an out-slot write failed after se_alloc. They now share guest.Place, which zeroes the bytes and clears the pointer slot on any failure. stashgen's run now closes the engine it was given. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Jmn7qSiWtt22aUYDwvgVL
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true |
|
This branch has not been deployed
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.
Requested by CipherStash · project thread
Summary
Fixes CIP-5160 (G1, G2). A failed hand-off to the guest no longer leaves a token or ZeroKMS response in guest memory, and
stashgenreleases its engine.Changes
place(encrypt) andplaceAuth(auth) were duplicates. They are replaced by oneguest.Placeininternal/guest.se_alloc,Placezeroes the bytes it wrote and clears the pointer slot, so a half-written out-slot pair cannot leave a dangling pointer.se_dealloc. The guest ABI docs allow a host import to re-enter only throughse_alloc, so the issue's suggested fix would violate them. The zeroed buffer is freed by the guest registry at shutdown.stashgen'srunnow closes the engine it was given when it implementsio.Closer, on every return path.Verification
go build,go vetandgo testpass forinternal/guest,auth,encrypt,cmd/stashgen, andstashgen.Related
Review notes
/code-review mediumraised these_deallocre-entry, a stale pointer slot, and wrapper/test placement. These were fixed. It also suggested the caller should own the engine's lifetime; I keptrunclosing it and documented that onrun.Generated by Claude Code