Skip to content

Conversation

@ezwiefel
Copy link
Contributor

Fixes #728.

This PR updates GoogleSecretManagerMapping to support robust case-insensitive secret retrieval.

Changes:

  • Maintains a map of both exact and lowercased secret names to their actual GCP identifiers.
  • Ensures that secrets with uppercase or mixed-case names (e.g. TEST_SECRET, mySecret) are correctly retrieved when case_sensitive=False.
  • Implements deterministic collision resolution: if multiple secrets normalize to the same lowercase key (e.g. MY_SECRET and my_secret), the lexicographically last one (preferring lowercase) is chosen.
  • Issues a UserWarning when such collisions occur.
  • Adds regression tests covering various casing scenarios and collision handling.
  • Updates documentation to explain the new behavior.

…Source

Update GoogleSecretManagerMapping to maintain a map of both exact and lowercased secret names to their actual GCP identifiers. Ensure that secrets with uppercase or mixed-case names (e.g. 'TEST_SECRET', 'mySecret') are correctly retrieved when 'case_sensitive=False'. Implement deterministic collision resolution (preferring lexicographically last/lowercase keys) and issue a UserWarning when collisions occur.
@hramezani
Copy link
Member

Thanks @ezwiefel

@hramezani hramezani merged commit cab6fc0 into pydantic:main Dec 15, 2025
19 checks passed
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.

GoogleSecretManagerSettingsSource fails to retrieve uppercase secrets when case_sensitive=False

2 participants