Repository navigation
Refuse pasted secrets as identifiers and read management bodies from objects only - #132
Merged
Merged
Conversation
Management routes that take a principal or group ID from their path or body, or a token ID from their path, now check it before building an audit target, log field or error body: a principal or group ID in the Broker secret namespace aab_, or a token ID that is not a UUID, answers 400 input_invalid naming the member, with no target. This applies the check the access-key and username routes already use to agent-token and administrator token inspect, revoke, pause and resume, and to every other principal and group route, through one shared check_ids helper. Well-formed identifiers keep their answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
serde's derived struct reader also takes a JSON array of the member values in order, so management request bodies accepted a positional form their contracts do not describe. Add ObjectOnly<T>, a wrapper over the existing object_only reader, and read every management body, the sign-in and password-change bodies, the audit list cursor and the root of every document the Broker stores and reads back through it: Json<ObjectOnly<T>> for extracted bodies, and ObjectOnly at the shared policy, resource, credential-verification and token-issue readers. Members reached through a single field or an existing reader hook (resource selections, the import definition, cursor filters) use object_only, and the import selection, the token-restriction wire and the token-restriction body use deserialize_object_only!. An array now gets the route's usual invalid-body answer; object bodies are read as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A principal or group ID in the Broker secret namespace aab_ is read as an ID again when it names a principal or group that exists: a managed principal, a managed group, or a configured group under TOML identity authority. A value that names none, or whose lookup fails, is still refused with 400 input_invalid and no target, so a pasted secret is neither echoed nor recorded. check_ids looks up prefixed values only, and the routes guarded earlier (principal and group inspect and update, the username and access-key issue routes, and the access-key list's principal parameter and cursor) use the same predicate. Creating a new principal or group with the prefix, access-key names and usernames stay refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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
Two input-handling fixes for behaviour that already existed on
main.A Broker secret pasted where an identifier belongs is no longer echoed or audited. Management routes copied a principal, group or token ID from the path or body into the audit target, logs or error body before validating it. Now a principal or group value with the reserved
aab_prefix that names no existing identity, and a token ID that is not a UUID, are refused with 400input_invalidbefore any audit target is built, with nothing derived from the value in the answer or the records. An existing principal or group whose ID has the prefix stays manageable, including on the routes that already refused the prefix. Creating a new identity with the prefix is still refused.Management and sign-in request bodies are JSON objects only. A positional JSON array was read as a body's members in order. Body roots, the nested selections and restrictions inside them, and stored or round-trip documents are now read from objects only; an array gets the route's usual invalid-body answer.
No change for well-formed requests. Details are in
docs/http-api.md.Validation
Limits
Operator-chosen names where
aab_is not reserved (bindings, rights, credentials, connections, services, resources, grants, imports) are unchanged.🤖 Generated with Claude Code