Skip to content

feat(vault): resolve every entry when no refs are given - #2114

Merged
jfallows merged 6 commits into
developfrom
claude/github-issue-1576-q79yld
Jul 10, 2026
Merged

jfallows merged 6 commits into
developfrom
claude/github-issue-1576-q79yld

Conversation

@jfallows

@jfallows jfallows commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

VaultHandler gains three new methods — initKeys(), initSigners(), and initTrust(KeyStore) — that resolve to every entry a vault instance is configured to expose, instead of requiring a caller to itemize aliases. This is for callers that have no way to invent or discover alias names ahead of time, such as a tls binding assembled dynamically by a composite generator.

The existing initKeys(List), initSigners(List), and initTrust(List, KeyStore) methods are unchanged from their original contract — null still just means "not configured." The wildcard is only reachable through the new dedicated methods, never by overloading a sentinel value on the existing parameter (the return type can only signal "nothing here" via null, so doubling that meaning onto the input side would have been lossy — see PR discussion for the earlier approach this replaces).

vault-filesystem implements the new methods by enumerating the underlying keystore, or by an optional entries: [...] allow-list on FileSystemStoreConfig (keys/trust/signers), so two vault instances can share one keystore/truststore file while each exposing a different subset. Once configured, entries is a hard boundary enforced the same way regardless of whether an alias is resolved via the wildcard or requested explicitly — a caller can't bypass the allow-list by naming an alias directly that isn't in entries.

TestVaultHandler (engine test implementation) implements the new methods by delegating to the existing list-based methods with its single configured key/signer alias and full trust list.

TlsBindingConfig calls the new wildcard methods only when none of keys/trust/signers is configured on the binding at all — a previously inert config shape — falling back from initKeys() to initSigners() for identity material, matching the existing keys-over-signers precedence. Every other configuration shape is byte-for-byte unchanged.

Also fixes a latent NPE in FileSystemVaultHandler's trust/cacerts-merge path that could be hit whenever no trust refs were configured but cacerts merging was requested.

Fixes #1576


Generated by Claude Code

claude added 6 commits July 10, 2026 16:34
VaultHandler.initKeys/initSigners/initTrust now treat a null or empty
ref list as "resolve every entry this vault instance exposes" instead
of an error/empty result, per #1576. This lets a
dynamically-assembled tls binding (e.g. a composite generator with no
way to invent alias names) reference a vault without itemizing every
alias.

vault-filesystem implements the wildcard by enumerating the
underlying keystore's entries, or restricts to a configured
entries: [...] allow-list on FileSystemStoreConfig (keys/trust/signers)
so two vault instances can point at the same shared keystore/truststore
while each exposing a different subset for the wildcard path.
Explicit alias lists are unaffected.

Also fixes a latent NPE in the trust cacerts-merge path when no trust
refs were given but trustcacerts merging was requested.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RyXdY3ZzQ4Hhqv4cf3RfBP
Revisits the initKeys/initSigners/initTrust wildcard design from the
previous commit. Overloading null/empty on the existing List<String>
parameter conflated too many concerns: the tls binding needs to know
whether trust/keys/signers was actually configured (to decide the
trustcacerts default), and the only way to signal "nothing resolved"
on the KeyManagerFactory/TrustManagerFactory return side is null, so
doubling up null's meaning on the input side was lossy.

VaultHandler gains initKeys(), initSigners(), and initTrust(KeyStore)
as new abstract methods (all four implementations are ours, so no
default-method back-compat concern). The existing List-based methods
revert to their original, pre-wildcard contract unchanged: null means
"not configured", exactly as before this feature existed.

FileSystemVaultHandler/TestVaultHandler implement the new methods by
resolving to every entry the vault instance is configured to expose
(entries allow-list, or full store enumeration for vault-filesystem;
the single configured alias for the test vault) and delegating into
the unchanged List-based methods.

TlsBindingConfig calls the new wildcard methods only when none of
keys/trust/signers is configured at all - a previously inert config
shape - preserving existing behavior everywhere else. Keys wildcard
tries initKeys() first, falling back to initSigners(), matching the
existing keys-over-signers precedence for the explicit-list path.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RyXdY3ZzQ4Hhqv4cf3RfBP
KeyManagerFactory.getInstance("PKIX") returns an X509ExtendedKeyManager
that reports internally-generated composite aliases (e.g. "1.0.alias1"),
not the literal keystore alias, so getPrivateKey(rawAlias) always
returned null for the new wildcard assertions. Resolve the private key
by matching the certificate's CN against the requested alias instead.
Resolving a private key by literal alias assumes the KeyManagerFactory
preserves the keystore alias string, which is an implementation detail
of the algorithm (PKIX renumbers aliases internally; SunX509 does not).
Assert on X509KeyManager.getServerAliases(keyType, issuers).length
instead, mirroring the existing trust-side wildcard tests that count
getAcceptedIssuers() rather than matching by name. This is guaranteed
by the KeyManager contract for any provider and needs no knowledge of
how a given algorithm derives its aliases.
Each wildcard test now reads linearly without jumping to a shared
private helper.
… too

entries was only consulted by the no-arg wildcard methods
(initKeys()/initTrust(KeyStore)/initSigners()). A caller passing an
explicit alias list bypassed it entirely, so a vault instance scoped to
a subset of a shared keystore file would still resolve any alias
physically present in that file. Move the check into the shared
key()/certificate() alias resolvers so entries is a hard boundary
regardless of how an alias is requested.
@jfallows
jfallows merged commit 1119473 into develop Jul 10, 2026
42 checks passed
jfallows pushed a commit that referenced this pull request Jul 10, 2026
Pulls in upstream fixes for the sandbox trust-store override (#2112) and
IPv6 unavailability (#2111) that this branch previously worked around
manually, plus new k3po reset-extension matching support (#2110, #2115)
and a vault entry resolution fix (#2114).
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.

Support tls deferring to vault for list of keys or trusted certificates, support filesystem vault

2 participants