Repository navigation
Conversation
samgbafa
force-pushed
the
skgbafa/tc-887-r8-harness-encrypt
branch
2 times, most recently
from
November 8, 2026 03:29
78882c3 to
3c00837
Compare
harness.sh gains TC887_AT_REST_ROOT_SOURCE: with env it generates a per-run root key, passes it as TINYCLOUD_AT_REST_ROOT_KEY and points the checks at it (TC887_NODE_ROOT_ENCODING). With mode encrypt or strict the checks now expect KV and SQL both sealed. CI runs the harness as a matrix: plaintext must stay RED, encrypt (root from the environment) must be GREEN.
The SQL check's payload heuristics can't see random bytes appended to a sealed part or a dropped WAL delta: both still look like ciphertext. The check now also opens every `database_artifact` row of the harness spaces with keys it re-derives itself from its root and the authenticated `_tc/` DEK mirrors (`key_mirror::recover_keys`), through `open_row` (manifest tag, each part's AEAD and exact length), and requires the parts to decode to a SQLite database that passes `PRAGMA integrity_check` and holds exactly the probe rows written. `selftest_sql_check_flags_appended_and_omitted_sealed_parts` proves an appended checkpoint or delta and a dropped delta each turn the check RED. The RED notices no longer say "plaintext", since a RED SQL check can now mean bytes that fail authentication.
samgbafa
force-pushed
the
skgbafa/tc-887-r7-sql-sealed
branch
from
November 8, 2026 03:38
27c7caf to
db538d6
Compare
samgbafa
force-pushed
the
skgbafa/tc-887-r8-harness-encrypt
branch
from
November 8, 2026 03:38
3c00837 to
b8ebe2f
Compare
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.
TC-887. This is the last PR of the refreshed at-rest stack (base: #521). The harness now checks a node that encrypts, not only that plaintext stays plaintext.
What
harness.sh:TC887_AT_REST_ROOT_SOURCE(escroworenv), which maps toTINYCLOUD_AT_REST__ROOT_SOURCE.env,upgenerates a per-run root key (standard base64 of 32 bytes, stored insecrets/at-rest-root-keywith mode 0600, never on argv or in logs) and passes it asTINYCLOUD_AT_REST_ROOT_KEY.harness.envnow carriesTC887_NODE_ROOT_FILEandTC887_NODE_ROOT_ENCODING, so the checks re-derive the key hierarchy from the root the node actually seals under.root_source.encryptorstrict,test rednow expects both KV and SQL to be green.at_rest_harness.rs:escrow_none: no escrow bundle or record may appear in the key mirror.rust.yml,at-rest-harness): now a matrix withfail-fast: false.test red --expect redmust find plaintext KV and SQL.TC887_AT_REST_MODE=encryptwithTC887_AT_REST_ROOT_SOURCE=env.test red --expect greenmust find KV blocks and SQL artifacts sealed, with every mirrored key authenticating under the env-derived hierarchy.Verification (local, native PostgreSQL + MinIO)
TC887_AT_REST_MODE=encrypt TC887_AT_REST_ROOT_SOURCE=env):test green: kv=green, sql=green.test red --expect green: "red checks as expected (kv=green, sql=green)".test green: green.test red --expect red: "both TC-887 RED checks report data not sealed at rest (KV and SQL)".SQL cold read (review follow-up, 3c00837). The SQL check's payload heuristics stayed GREEN with a trigger appending random bytes to every payload. The check now opens every artifact row with keys it re-derives from its root and the authenticated DEK mirrors, through
open_row(manifest tag, AEAD, exact length), and requires a SQLite database that passesPRAGMA integrity_checkand holds exactly the rows written.selftest_sql_check_flags_appended_and_omitted_sealed_partscovers appended checkpoint/delta bytes and a dropped delta. Local run (encrypt leg): clean = kv=green, sql=green; with aBEFORE INSERT OR UPDATEtrigger appending 32 random bytes topayload: SQL RED (checkpoint failed its at-rest integrity check).