Repository navigation
Conversation
AuthZEN 1.0 Section 5.3 defines an optional properties key on the action object, and Section 10.1.1 requires receivers to ignore unknown fields in request bodies. The AuthZEN request records inherited the server-wide strict Jackson behaviour, so requests carrying action.properties, unknown keys inside options, or any unknown field were rejected with 400 before authentication. - add the optional properties map to AuthZen.Action - annotate the AuthZEN request records with @JsonIgnoreProperties(ignoreUnknown = true) - per the open question in the issue, action.properties is accepted but not merged into the evaluation context in this first step - cover action.properties, unknown fields (top-level, subject, resource, action, evaluations item) and unknown option keys with integration tests Signed-off-by: Inf1mum <vadimlazuk5@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
The action name is not required, so invalid requests can return a 200 denial instead of a 400 error.
1 open issue
What changed in this PR
Improves AuthZEN 1.0 request compatibility in Keycloak’s authorization services, addressing #54542.
Changes:
- Accepts optional
action.propertieswithout adding them to the policy evaluation context. - Ignores unknown fields across single and batch evaluation request records.
- Adds regression tests for action properties and unknown request fields.
| File | Description |
|---|---|
authzen/tests/base/src/test/java/org/keycloak/tests/authzen/AuthZenEvaluationTest.java |
Tests action properties and unknown fields in single evaluations. |
authzen/tests/base/src/test/java/org/keycloak/tests/authzen/AuthZenEvaluationsTest.java |
Tests unknown option keys and action properties within batch items. |
authzen/services/src/main/java/org/keycloak/authorization/authzen/AuthZen.java |
Adds action properties, preserves the convenience constructor, and enables unknown-field tolerance. |
Review effort: Balanced
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public record Action(String name) {} | ||
| public record Action(String name, Map<String, Object> properties) { |
hakdogan
left a comment
There was a problem hiding this comment.
I tested the PR locally: I replaced the AuthZEN services jar in today's quay.io/keycloak/keycloak:nightly image (999.0.0-SNAPSHOT, built 2026-11-17) with one built from this branch and compared it with the unmodified image. I also ran the authzen/tests/base suite (123/123, Spotless clean).
All cases from the issue now return 200 with the expected decision, where nightly returns 400:
action.properties(scalar, nested, empty,null)- unknown fields at the top level and inside
subject,resourceandaction - unknown fields inside an
evaluationsitem, at the top level of an Access Evaluations request, and unknown keys insideoptions(also whenevaluations_semanticis absent)
action.properties does not reach the evaluation context. A regex policy on channel with "action":{"name":"read","properties":{"channel":"web"}} still denies, as the description says.
The existing 400s are unchanged: missing required fields, invalid JSON, an unknown subject.type, an invalid evaluations_semantic, and a non-object action.properties (string or array).
Two side effects that may be worth noting in the description:
- The body is parsed before the token is checked, so a request with an unknown field and a missing or invalid token used to get 400. It now gets 401.
- A duplicate key in
action, for example"action":{"name":"write","name":"read"}, returns 500 on nightly (InvalidDefinitionException: No fallback setter/field defined for creator property 'name'). With this PR the last value wins, which matches what already happens for a duplicate key insubject.
The PR also merges cleanly with #55258, and the combined suite passes (126/126).

Fixes #54542
What
AuthZEN evaluation requests that carry
action.properties, unknown keys insideoptions, or any unknown field (top-level or insidesubject,resource,action, or anevaluationsitem) are currently rejected with400 Bad Requestbefore authentication. Two causes, both fixed here:AuthZen.Actionwas declared asrecord Action(String name), so the OPTIONALpropertieskey defined by AuthZEN 1.0 Section 5.3 failed request parsing withUnrecognized field "properties".KcUnrecognizedPropertyExceptionHandlerturned it into a 400. AuthZEN 1.0 Section 10.1.1 requires: "To ensure forward compatibility, receivers MUST ignore unknown fields present in request or response bodies."How
propertiesmap toAuthZen.Action(a convenienceAction(String name)constructor keeps existing call sites working).Subject,Resource,Action,EvaluationRequest,EvaluationItem,Options,EvaluationsRequest) with@JsonIgnoreProperties(ignoreUnknown = true).Scope note (regarding the open question in the issue):
action.propertiesis accepted but, in this first step, not merged into the evaluation context, as proposed in the issue description. If maintainers prefer it to feed the claim/context map, that can be a follow-up together with the related property-collision questions discussed in #53328 and #54848.Tests
AuthZenEvaluationTest:action.propertiesaccepted; unknown fields ignored insideaction,subject,resource, and at the top level (all previously 400).AuthZenEvaluationsTest: unknown keys insideoptionsnext toevaluations_semantic;action.propertiesplus an unknown field inside anevaluationsitem.The pre-existing 400 behaviour for missing/invalid required fields and invalid JSON is unchanged and remains covered by the tests already in these classes.