Skip to content

transit: warn when key_usages is supplied on key config writes - #32073

Open
SashaMIT wants to merge 1 commit into
hashicorp:mainfrom
SashaMIT:transit/warn-on-readonly-key-usages
Open

transit: warn when key_usages is supplied on key config writes#32073
SashaMIT wants to merge 1 commit into
hashicorp:mainfrom
SashaMIT:transit/warn-on-readonly-key-usages

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 6, 2026

Copy link
Copy Markdown

Summary

transit/keys/<name>/config declares key_usages as a writable field, but the write handler never reads it. Usages are derived from the key type (p.Type.KeyUsages()), which is also what the response returns.

Because the field is declared in the schema, Vault's unused/ignored-parameter warning never fires when a client supplies it. An operator can POST key_usages=["digital-signature"] to an encryption key's config, receive a successful response, and believe the key is now signature-only when nothing changed. That is a silent failure on a security-relevant setting.

Fix

Emit a warning when key_usages is supplied on the write path, matching the existing warning pattern used for forced min-version adjustments:

key_usages is derived from the key type and cannot be changed; the supplied value was ignored

This keeps API compatibility (clients that send the field do not break) while surfacing the no-op.

Test plan

  • New test: supplying key_usages on config write returns the warning
  • TestTransit_KeyUsages*, TestTransit_ConfigSettings, TestTransit_UpdateKeyConfigWithAutorotation pass

Made with Cursor

The keys/<name>/config endpoint declares key_usages as a writable
field, but the write handler never reads it: usages are derived from
the key type. Because the field is declared, Vault's unused-parameter
warning never fires, so an operator who POSTs key_usages believing they
restricted a key's operations gets a silent no-op.

Emit a warning when the field is supplied, matching the existing
warning pattern for forced min-version adjustments.

Made-with: Cursor
@SashaMIT
SashaMIT requested a review from a team as a code owner August 6, 2026 16:50
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vault-ui Error Error Aug 6, 2026 4:51pm

Request Review

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 6, 2026
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deployment failed for project vault-ui with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `public`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

@hashicorp-cla-app

hashicorp-cla-app Bot commented Aug 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

secret/transit size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant