Skip to content

feat(stack-kms): typed errors and payload checks for key vendor backends (CIP-5304) - #1522

Closed
freshtonic wants to merge 1 commit into
james/cip-5203-make-stack-encrypt-work-with-aws-kms-azure-kms-hashicorpfrom
james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral
Closed

freshtonic wants to merge 1 commit into
james/cip-5203-make-stack-encrypt-work-with-aws-kms-azure-kms-hashicorpfrom
james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral

Conversation

@freshtonic

@freshtonic freshtonic commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Layer 2 of the CIP-5203 stack. Implements CIP-5304.

  • KeyLifetime is returned with the index key, and the stack-encrypt keyset cache obeys it.
  • Error::Backend { vendor, kind, source } and Error::ZeroKmsOnly are added, with refuse_zerokms_extensions for key vendor backends.
  • IndexKey::from_key_bytes is a public constructor.
  • stack-kms takes a breaking change (0.2).

Decisions made without review are in docs/plans/2026-11-05-key-vendor-backends-decisions.md. Read the CIP-5304 and orchestrator sections.

@freshtonic
freshtonic added this pull request to stack #1523 November 4, 2026 23:45
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.

@changeset-bot

changeset-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cd90970

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@freshtonic freshtonic changed the title james/cip 5304 make datakeysource and indexkeysource vendor neutral feat(stack-kms)!: vendor-neutral key source traits and key lifetime (CIP-5304) Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Mutation testing (cargo-mutants, --in-diff, stack-auth + stack-encrypt)

caught missed unviable timeout
20 0 12 0

Every mutant in the changed lines was caught by a test.

@freshtonic
freshtonic force-pushed the james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral branch from 8a5f036 to d6c5305 Compare November 6, 2026 05:10
@freshtonic
freshtonic force-pushed the james/cip-5203-make-stack-encrypt-work-with-aws-kms-azure-kms-hashicorp branch from 707a00b to 64c59ec Compare November 6, 2026 05:10
@freshtonic
freshtonic force-pushed the james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral branch from d6c5305 to cd77cf8 Compare November 9, 2026 04:16
@freshtonic
freshtonic force-pushed the james/cip-5203-make-stack-encrypt-work-with-aws-kms-azure-kms-hashicorp branch from 64c59ec to d23ee85 Compare November 9, 2026 04:16
@freshtonic
freshtonic removed this pull request from stack #1523 November 9, 2026 04:17
@freshtonic
freshtonic added this pull request to stack #1579 November 9, 2026 04:17
@freshtonic
freshtonic force-pushed the james/cip-5203-make-stack-encrypt-work-with-aws-kms-azure-kms-hashicorp branch from d23ee85 to a787ddd Compare November 10, 2026 02:37
@freshtonic
freshtonic force-pushed the james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral branch 2 times, most recently from 8036d19 to fb05412 Compare November 12, 2026 03:44
@freshtonic
freshtonic force-pushed the james/cip-5203-make-stack-encrypt-work-with-aws-kms-azure-kms-hashicorp branch from a787ddd to dffc9f5 Compare November 12, 2026 03:44
@freshtonic
freshtonic removed this pull request from stack #1579 November 12, 2026 03:45
@freshtonic freshtonic changed the title feat(stack-kms)!: vendor-neutral key source traits and key lifetime (CIP-5304) feat(stack-kms): typed errors and payload checks for key vendor backends (CIP-5304) Nov 12, 2026
@freshtonic
freshtonic added this pull request to stack #1623 November 12, 2026 03:47
@freshtonic

Copy link
Copy Markdown
Contributor Author

Scope reduced (2026-11-12). This branch was rebuilt from one final tree by path, and the follow-up PRs #1555 to #1563 were folded in. The plan is docs/plans/2026-11-12-key-vendor-backends-scope-reduction.md; the decision log's "Scope reduction" section records each change. Decisions: no stack-encrypt change, no v2 leaf, and the wrapped data key mode deferred.

In this PR: stack-kms keeps only what a vendor needs: Error::Backend with a typed KeyVendor, Error::ZeroKmsOnly and refuse_zerokms_extensions, IndexKey::from_key_bytes, the stable vendor and mode bytes, and the ZeroKmsKeySource marker. Removed: KeyLifetime, LoadedIndexKey, SelectedKeyset, the per-settle index key, key_backend/keyset_backend/key_mode and RetrieveKeyPayload::key_mode. The key source traits are as on next. The stack-encrypt key lifetime work that was here is gone.

…nds (CIP-5304)

Add Error::Backend and Error::ZeroKmsOnly, refuse_zerokms_extensions,
IndexKey::from_key_bytes, the stable KeyVendor and KeyMode bytes, and the
ZeroKmsKeySource marker. The key source traits are unchanged, so
stack-encrypt does not change.
@freshtonic
freshtonic force-pushed the james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral branch from fb05412 to cd90970 Compare November 12, 2026 05:24
@freshtonic
freshtonic force-pushed the james/cip-5203-make-stack-encrypt-work-with-aws-kms-azure-kms-hashicorp branch from dffc9f5 to 9a17fe4 Compare November 12, 2026 05:24
@freshtonic
freshtonic removed this pull request from stack #1623 November 12, 2026 05:28
@freshtonic

Copy link
Copy Markdown
Contributor Author

Replaced by #1632, in the new stack #1633. The code is the same, rebased onto the latest next. The ADRs are now ADR-0013 and ADR-0014, and the text about the wrapped data key mode is removed.

@freshtonic freshtonic closed this Nov 12, 2026
@freshtonic
freshtonic deleted the james/cip-5304-make-datakeysource-and-indexkeysource-vendor-neutral branch November 12, 2026 05:52
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