Validate admin API provisioner payloads; minor status-code fixes - #2755
Open
coffee4tw wants to merge 9 commits into
Open
Validate admin API provisioner payloads; minor status-code fixes#2755coffee4tw wants to merge 9 commits into
coffee4tw wants to merge 9 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBsTWD57oxThZz44wVy3EL
Authority.UpdateProvisioner wrapped Init() failures as an internal server error (500), unlike StoreProvisioner which correctly treats them as a client-side configuration problem (400). Bad or incomplete provisioner details submitted via UpdateProvisioner now surface as a 400, matching StoreProvisioner's behavior.
PUT (update) is not a resource-creation operation, so it should not return 201 Created. Verified safe against the shipped ca.AdminClient, which only checks for status >= 400.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Hardens admin provisioner create/update handling and fixes the provisioner
webhook update response:
POST/PUT /admin/provisioners:new writes reject missing or nil details and require the linkedca details
oneof to match the declared provisioner type.
validation remains in
provisioner.Interface.Init.Initfailures return structured 400 errors instead of 500s.do not match can still load during admin-resource reload; only new
Store/Update writes enforce the invariant.
200 OKinstead of201 Created(createstill returns 201).
[Unreleased].Compatibility
Successful, valid provisioner requests are unchanged. Malformed new writes
now fail with 400s. Read/reload conversion deliberately preserves historical
behavior for legacy mismatched records so an upgrade cannot turn one such
record into a CA startup failure.
The shipped
ca.AdminClienttreats any status below 400 as success on webhookupdate, so the 201→200 correction is compatible with existing clients.
Test plan
missing details, missing oneofs, and typed-nil inner messages.
returning 400.
the admin-resource conversion path.
Initconfiguration returning 400.go test ./...passes on the final pushed checkout.go vet ./authority/...passes.🤖 Generated with Claude Code
https://claude.ai/code/session_01LBsTWD57oxThZz44wVy3EL