Skip to content

Refuse pasted secrets as identifiers and read management bodies from objects only - #132

Merged
kcosr merged 5 commits into
mainfrom
fix/strict-management-inputs
Nov 30, 2026
Merged

kcosr merged 5 commits into
mainfrom
fix/strict-management-inputs

Conversation

@kcosr

@kcosr kcosr commented Nov 29, 2026

Copy link
Copy Markdown
Owner

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 400 input_invalid before 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

  • Full Rust suite (5,470 passed), doctests, strict clippy, formatting, public API check (unchanged), crate boundaries, sample configuration, changelog and documentation checks
  • Table-driven tests: a pasted secret leaves no trace on 71 route cases; existing prefixed identities work on 16 routes; a positional array is refused on 33 cases
  • Independent review: one finding (existing prefixed identities were locked out), fixed; re-review clean

Limits

Operator-chosen names where aab_ is not reserved (bindings, rights, credentials, connections, services, resources, grants, imports) are unchanged.

🤖 Generated with Claude Code

Kevin and others added 5 commits November 29, 2026 16:05
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>
@kcosr
kcosr merged commit e0ff5bd into main Nov 30, 2026
2 checks passed
@kcosr
kcosr deleted the fix/strict-management-inputs branch November 30, 2026 03:45
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.

1 participant