Skip to content

Commit 6cf4e24

Browse files
committed
test(stack-encrypt): enroll the owned-column drop witnesses, which see a leak the heap observer cannot
1 parent eda3411 commit 6cf4e24

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

‎conformance/stack-encrypt/lifecycle-contract.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ process. Python and TypeScript are explicitly not enrolled.
1212
|---|---|---|
1313
| `lifecycle-ownership-v1` | Actual record operations and owned `Vec<S>` to `Vec<T>` conversions release fulfilment captures exactly once on success, provider failure and unpolled drop; zipped fulfilments do not share key material. | Client keys are consumed/redacted; explicit close and unreachable-client cleanup release guest memory; calls on a closed client fail. GC cleanup is eventual, so callers should close explicitly. |
1414
| `lifecycle-cancellation-v1` | Dropping a future paused in generation, for a record operation or an owned column, drops the provider future and operation captures; subsequent work on the cipher succeeds. Guest ABI abort spends the handle and drops the operation. | Cancellation before a call sends no request; cancellation between steps or during token fetch leaves unrelated operations usable. A guest step that overruns cancellation closes the client. Discarded late output is wiped. |
15-
| `lifecycle-partial-output-v1` | A batch with a valid first row and a later authenticated type mismatch releases its decoded prefix without marked heap residue, through the dynamic record path and the owned `Vec<Ciphertext>` to `Vec<String>` conversion alike. Existing context cases reject late authentication failures without returning partial output. | Generated and raw batch APIs return no partial rows on failure; interrupted HTTP bodies fail; cancelled output is wiped. SDK conversion diagnostics contain no decrypted values. This does not assert erasure of partially populated caller-owned Go objects. |
16-
| `lifecycle-buffer-cleanup-v1` | The existing allocator observer checks selected write/read/JSON parse paths, including an owned `Vec<String>` column sealed through its guard, and has a negative control. Guest ABI tests check buffer-registry cleanup, error-buffer release and protected text drop. | Request bodies survive until their owner closes them, then wipe; refused requests wipe; heap growth wipes abandoned backing arrays; guest runtime close releases memory. Post-encryption memory scans are supplementary observations. |
15+
| `lifecycle-partial-output-v1` | A batch with a valid first row and a later authenticated type mismatch releases its decoded prefix without marked heap residue, through the dynamic record path and the owned `Vec<Ciphertext>` to `Vec<String>` conversion alike; owned-column drop witnesses show that prefix is wiped, not leaked, after a late failure or a panicking element conversion. Existing context cases reject late authentication failures without returning partial output. | Generated and raw batch APIs return no partial rows on failure; interrupted HTTP bodies fail; cancelled output is wiped. SDK conversion diagnostics contain no decrypted values. This does not assert erasure of partially populated caller-owned Go objects. |
16+
| `lifecycle-buffer-cleanup-v1` | The existing allocator observer checks selected write/read/JSON parse paths, including an owned `Vec<String>` column sealed through its guard, and has a negative control. Drop witnesses show an owned column's source is wiped before its pending is returned, including on a refused or panicking context. Guest ABI tests check buffer-registry cleanup, error-buffer release and protected text drop. | Request bodies survive until their owner closes them, then wipe; refused requests wipe; heap growth wipes abandoned backing arrays; guest runtime close releases memory. Post-encryption memory scans are supplementary observations. |
1717
| `lifecycle-diagnostics-v1` | Guest errors discard untrusted foreign cause messages; failed/successful exports do not hand over stale diagnostics. | Structured errors remain available after failures; SDK errors and redacted display/logging expose types or fields rather than plaintext values. |
1818
| `lifecycle-validation-before-io-v1` | Existing runtime/read/context cases count provider calls. Wrong shape, independently detectable context mismatch and oversized descriptors fail before key I/O; lazy assembly stops after local failure. | Host refusals happen before entering the guest, and shared runtime/read cases exercise the uninitialised guest's preflight boundary. Go does not yet expose native provider counters. |
1919
| `lifecycle-logical-batching-v1` | Instrumented `DataKeySource` calls establish one logical generation batch, retrieval grouping by keyset, descriptor ordering and no work for empty batches, for record operations and for an owned `Vec<S>` column of any length including zero. | Go uses the same engine, but this profile does not claim independently instrumented Go key-request counts. |
@@ -59,7 +59,11 @@ These entries in the index are limitations, not successful requirements:
5959
sealing frame by backtrace and reports excluded frees. It scrubs stack residue
6060
before observing heap frees; it does not prove stack erasure. Its JSON query
6161
paths use borrowed/static path text because owned path copies have separate
62-
cleanup limitations. The lifecycle runner preserves the observer's output.
62+
cleanup limitations. It sees only blocks that are freed: plaintext leaked and
63+
never freed is not observed. For the owned `Vec<S>` conversion, drop
64+
witnesses in `packages/stack-encrypt/tests/collections.rs` observe the wipe
65+
itself, so a leaked source or recovered prefix fails there. The lifecycle
66+
runner preserves the observer's output.
6367
- **`caller-owned-host-values` — outside the guarantee.** Caller-owned strings,
6468
bytes, objects, returned plaintext, aliases and copies remain the caller's
6569
responsibility. Ownership transfer or protected borrowing must be stated by

‎conformance/stack-encrypt/v1/lifecycle-v1.enrollment.json‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
"binary": "heap_hygiene",
2828
"success_output": "immediate"
2929
},
30+
"collections": {
31+
"language": "rust",
32+
"lane": "fast",
33+
"workspace": ".",
34+
"package": "stack-encrypt",
35+
"features": ["--all-features"],
36+
"binary": "collections"
37+
},
3038
"runtime": {
3139
"language": "rust",
3240
"lane": "fast",
@@ -132,6 +140,10 @@
132140
"a_late_read_type_failure_leaves_no_plaintext_on_the_heap",
133141
"a_late_type_failure_in_an_owned_column_leaves_no_plaintext_on_the_heap"
134142
],
143+
"collections": [
144+
"a_late_element_failure_wipes_the_plaintext_recovered_before_it",
145+
"a_panicking_element_conversion_wipes_the_plaintext_recovered_before_it"
146+
],
135147
"contexts": ["shared_context_boundaries"],
136148
"go": [
137149
"TestContextBoundaries",
@@ -151,6 +163,11 @@
151163
"a_json_document_read_from_a_frame_leaves_no_plaintext_on_the_heap",
152164
"the_spy_sees_an_unwiped_free"
153165
],
166+
"collections": [
167+
"owned_elements_are_wiped_before_the_pending_is_returned",
168+
"owned_elements_are_wiped_when_the_context_is_refused",
169+
"owned_elements_are_guarded_during_context_conversion"
170+
],
154171
"guest-abi": [
155172
"buffers::tests::wipe_all_leaves_no_live_buffer",
156173
"last_error::tests::clearing_wipes_and_frees_the_registered_buffer",

0 commit comments

Comments
 (0)