Skip to content

feat(TC-887): at_rest data key types and DataKeyProvider trait - #320

Merged
samgbafa merged 2 commits into
mainfrom
skgbafa/tc-887-at-rest-keys
Oct 17, 2026
Merged

samgbafa merged 2 commits into
mainfrom
skgbafa/tc-887-at-rest-keys

Conversation

@samgbafa

@samgbafa samgbafa commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of TC-887 (encryption at rest). First of several small PRs; this one adds types only.

What changed

  • New module tinycloud_core::at_rest (tinycloud-core/src/at_rest/):
    • DekId, DataKey (DEK bytes + id) and ObjectNameKey. Key bytes are zeroized on drop and never printed by Debug; there is no public byte accessor.
    • DataKeyProvider trait (current_key, key, object_name_key) and DataKeyError (Locked, UnknownKey, Backend).
    • FixedKeyProvider (at_rest/testing.rs): deterministic in-memory provider for tests (keys derived from a public seed; can be built locked). Compiled only for tinycloud-core's own tests or with the new test-util feature (for downstream dev-dependencies); its Debug doesn't print the seed.
  • tinycloud-core gains a direct zeroize = "1" dependency (already in Cargo.lock transitively) and a test-util feature. test/m1-realdata-e2e/Cargo.lock refreshed.
  • Nothing in the node calls this module. No behaviour, config or schema change.

The interface is agreed between the envelope and key-continuity work; the key-continuity branch stacks on this one.

How it's tested

  • cargo test -p tinycloud-core --lib at_rest: 3 tests
    • Debug of DataKey/ObjectNameKey/FixedKeyProvider does not contain the key or seed bytes;
    • FixedKeyProvider serves ids 1..=current per space, distinct per space and id, and returns UnknownKey for 0 and ids above current;
    • a locked provider returns Locked from all three methods.
  • cargo clippy -p tinycloud-core --all-targets -- -D warnings, cargo clippy -p tinycloud-core --features test-util -- -D warnings and cargo fmt --check: clean.
  • cargo metadata --locked for the workspace and test/m1-realdata-e2e: pass.

Merge order: after the current main release is cut (TC-887 plan §7).

Adds tinycloud_core::at_rest with DekId, DataKey and ObjectNameKey
(zeroized on drop, redacted Debug), the DataKeyProvider trait with
DataKeyError, and a deterministic FixedKeyProvider for tests.
Nothing in the node uses the module yet.
@samgbafa

Copy link
Copy Markdown
Contributor Author

REQUEST_CHANGES: see TC-887 (reviewed head db56854)

FixedKeyProvider moves to at_rest/testing.rs, compiled only for this
crate's tests or with the new test-util feature. Its Debug no longer
prints the seed. Refresh test/m1-realdata-e2e/Cargo.lock for zeroize.
@samgbafa

Copy link
Copy Markdown
Contributor Author

APPROVE: see TC-887 (reviewed head bc618de)

1 similar comment
@samgbafa

Copy link
Copy Markdown
Contributor Author

APPROVE: see TC-887 (reviewed head bc618de)

@samgbafa
samgbafa merged commit 5ed2008 into main Oct 17, 2026
19 checks passed
samgbafa added a commit that referenced this pull request Oct 17, 2026
…kfiles in CI (#332)

* fix(TC-887): refresh the w5 lockfile and check separate workspace lockfiles in CI

test/w5-policy-runtime-node-e2e/Cargo.lock lacked tinycloud-core's new
aes, hkdf and zeroize dependencies and the aes/aes-gcm zeroize features
(#320, #322), so cargo --locked failed there. Regenerated minimally.

CI built only the main workspace and m1-realdata-e2e. A new lockfiles
job resolves every fetchable workspace with --locked and runs
scripts/ci/check-separate-lockfiles.py, which checks the w5 lockfile
(its private git dependency is not fetchable in CI) for in-repo crates'
direct dependencies and requested dependency features.

* ci(TC-887): drop the hand-rolled w5 lockfile checker

Keep the w5 lockfile fix and the --locked resolves of main, m1 and
test/load/signer. w5 coverage follows separately with real cargo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant