VaultSharp.Extensions.Configuration
VaultSharp.Extensions.Configuration copied to clipboard
fix: handle null values in Vault secrets to prevent NullReference
This PR fixes an issue where the configuration provider throws a NullReferenceException when Vault secrets contain keys with null values. The root cause was an invalid cast of a null value to JsonElement.
The fix adds a null check and creates a JsonElement representing a JSON null (JsonValueKind.Null) when the value is null. This ensures that:
-
Keys with null values are properly included in the configuration.
-
No exceptions are thrown during configuration loading.
-
Consumers of IConfiguration can safely detect and handle keys with null values.
Issue: NullReferenceException when Vault secret contains null values in keys #70