-
VaultHttp.PostAsync: JSON double-encoding caused HTTP 400 from Vault/OpenBaoPostAsyncmanually serialized the request body to a JSON string usingJsonSerializer.Serialize, then passed that string torequest.AddJsonBody(). In RestSharp ≥ 106,AddJsonBodyre-serializes whatever object it receives — when the argument is astring, it encodes it as a JSON string literal, wrapping the content in quotes and escaping the inner characters. Vault/OpenBao received"{\\"csr\\":\\"...\\"}"(a JSON-encoded string) instead of{"csr":"..."}(a JSON object) and returned HTTP 400 "error parsing JSON".Fixed by replacing
request.AddJsonBody(serializedParams)withrequest.AddStringBody(serializedParams, ContentType.Json).AddStringBodysends the string as the raw request body without re-encoding it. -
ThrowOnAnyError = truemade theBadRequesterror-parsing block dead codeRestClientOptionswas constructed withThrowOnAnyError = true, which causes RestSharp to throw an exception on any non-2xx response before returning to the caller. ThePostAsyncmethod had explicit handling forHttpStatusCode.BadRequestthat deserialized Vault error messages and threw a descriptive exception — but that block was never reached because RestSharp threw first, and the actual Vault error body was lost.Fixed by removing
ThrowOnAnyError = truefromRestClientOptionsand addingresponse.ThrowIfError()after the explicitBadRequesthandler, so non-2xx responses that are notBadRequeststill surface as exceptions whileBadRequestresponses are handled with full Vault error body parsing. -
ValidateCAConnectionInfoandValidateProductInfo:KeyNotFoundExceptionon gateway config PUT/POSTBoth validation methods used direct
Dictionary.get_Itemindexers (connectionInfo[key]) to read parameters. The gateway does not always pre-populate every parameter key before calling validation, so any absent key threwKeyNotFoundExceptionand surfaced as an opaque HTTP 500 from the gateway config endpoint.Fixed by replacing all direct indexers with
TryGetValuecalls throughout both methods.Additionally relaxed the
RoleNamerequirement inValidateProductInfo: theEnrollpath already falls back toProductIDwhenRoleNameis absent, so the validator no longer rejects configurations that omit it. The check now only errors ifRoleNameis explicitly present but empty.
- Dropped .NET 6.0 target (EOL). The project now targets
net8.0andnet10.0.
- bug fix: _certDataReader is now initialized in the Initialize method
- added retrieval of roles associated with enrolled certificates via metadata for Vault Enterprise users
- initial release