Skip to content

kms: fix semantics for HSMs added by 56df5fe4#34

Merged
aead merged 1 commit intomainfrom
hsm-fix
May 27, 2025
Merged

kms: fix semantics for HSMs added by 56df5fe4#34
aead merged 1 commit intomainfrom
hsm-fix

Conversation

@aead
Copy link
Member

@aead aead commented May 27, 2025

This commit fixes the semantics of the HSMs and ActiveHSMs, now ConfiguredHSMs fields.

Before, the HSMs field contained all HSMs "present" at the KMS server (configured ones and ones with an on-disk entry), and the ActiveHSMs field contain only the configured HSMs for which an on-disk entry exists.

The problem with such an approach is that you cannot distinguish between HSMs that are configured but don't have an on-disk entry (because it got deleted) and HSMs that have an on-disk entry but are not configured. Both would appear in the list of HSMs but not in the list of ActiveHSMs.

This commit fixes this. Now, the HSMs list contains only HSMs with an on-disk entry and the ConfiguredHSMs list contains only HSMs for which a configuration is currently present.

The list of all HSMs (what the HSMs field used to be) is simply the union of HSMs and ConfiguedHSMs. Configured HSMs without an on-disk entry appear in ConfiguredHSMs but not in HSMs and HSMs without a configuration but a (stale or fallback) on-disk entry appear in HSMs but not in ConfiguredHSMs.

This semantic change can be made since support for multiple HSMs is not released yet.

This commit fixes the semantics of the `HSMs` and `ActiveHSMs`,
now `ConfiguredHSMs` fields.

Before, the `HSMs` field contained all HSMs "present" at the KMS
server (configured ones and ones with an on-disk entry), and the
`ActiveHSMs` field contain only the configured HSMs for which an
on-disk entry exists.

The problem with such an approach is that you cannot distinguish
between HSMs that are configured but don't have an on-disk entry
(because it got deleted) and HSMs that have an on-disk entry but
are not configured. Both would appear in the list of `HSMs` but
not in the list of `ActiveHSMs`.

This commit fixes this. Now, the `HSMs` list contains only HSMs
with an on-disk entry and the `ConfiguredHSMs` list contains only
HSMs for which a configuration is currently present.

The list of all HSMs (what the `HSMs` field used to be) is simply
the union of `HSMs` and `ConfiguedHSMs`. Configured HSMs without
an on-disk entry appear in `ConfiguredHSMs` but not in `HSMs` and
HSMs without a configuration but a (stale or fallback) on-disk entry
appear in `HSMs` but not in `ConfiguredHSMs`.

This semantic change can be made since support for multiple HSMs is
not released yet.

Signed-off-by: Andreas Auernhammer <github@aead.dev>
Copy link

@shtripat shtripat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aead aead merged commit 986f219 into main May 27, 2025
5 checks passed
@aead aead deleted the hsm-fix branch May 27, 2025 10:51
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.

3 participants