#66042·symfony

[KeyManagement] Follow-ups from the component's review

Author: nicolas-grekasCreated Sep 14, 2026Updated Sep 24, 2026
LabelsEnhancement

The KeyManagement component was merged in #64052. These came out of the review rounds and were deliberately left out of that pull request, either because they need a design decision of their own or because they cannot be verified without a live backend. The component is @experimental, so the interface changes below are still free to make.

  • Invalidate a cached token on a 401 or 403. ClientCredentialsTokenProvider (Azure) and ServiceAccountTokenProvider (Google Cloud) cache a token until expires_in elapses, and neither the bridge nor the interface can tell them to drop it. A token revoked or rotated server-side is therefore retried until its lifetime runs out, and every call in between fails. It needs a decision between an invalidation method on TokenProviderInterface and a drop-and-retry-once inside the two KMS classes. This is the only operational defect in the list.
  • Give the HTTP bridges default timeouts. None of the five factories sets timeout, max_duration or max_redirects, so a stalled provider holds a request for the client's default idle timeout with no cap on the whole exchange. The values are the decision here.
  • Let key_management.store.max_age express "never rotate". DataKeyStore accepts null for exactly that, while the configuration node is an integer with a minimum of zero, so the one thing the store can do cannot be configured. Either widen the node or document that zero rotates on every call. https://github.com/symfony/symfony/pull/66211
  • Memoize the Flysystem key loader, or say why not. It reads the key material through Flysystem on every lookup, which is one round trip per operation against a remote storage with self-contained envelopes, and one per data key with a store. The readme now states the behaviour; the loader is a service and could hold what it read for its lifetime. https://github.com/symfony/symfony/pull/66229
  • Run the HashiCorp Vault derived-key preflight against a live Transit engine. When an AAD is passed, the bridge reads the key once and refuses a non-derived one, because Vault ignores rather than rejects a context on those. That logic is written from the documented semantics of the derived field and has only ever run against mocks.
  • Document that case folding does not canonicalize an internationalized domain. BlindIndex\Email and BlindIndex\EmailDomain lowercase the domain, which is right for an ASCII label, but the composed and decomposed spellings of the same Unicode label produce different tags. An application that stores such addresses should normalize with idn_to_ascii() before indexing. Worth a paragraph in the documentation rather than a code change.
  • Consider the global Doctrine type registry holding a previous kernel's store. EncryptedType keeps the encrypter, which keeps the store and its unwrapped key material, and the registry is process-global, so a kernel reboot inside a test run leaves the previous store's keys reachable until the type name is registered again. Only reachable in tests today, which is why it is last. https://github.com/doctrine/DoctrineBundle/pull/2221