Skip to content

fix: correct Bearer token formatting in UMA rego policy for Keycloak#904

Merged
silvi-t merged 1 commit intoKuadrant:mainfrom
silvi-t:keycloak-rego-fix
Mar 25, 2026
Merged

fix: correct Bearer token formatting in UMA rego policy for Keycloak#904
silvi-t merged 1 commit intoKuadrant:mainfrom
silvi-t:keycloak-rego-fix

Conversation

@silvi-t
Copy link
Copy Markdown
Contributor

@silvi-t silvi-t commented Mar 25, 2026

Summary

  • Fix Bearer token Authorization header formatting in UMA OPA rego policy to comply with stricter parsing in Keycloak 26.5.4+ (CVE-2026-0707)

Details

Keycloak 26.5.4 includes a fix for CVE-2026-0707 ("Incorrect Behavior Order: Authorization Before Parsing and Canonicalization"), which enforces stricter Authorization header parsing per RFC 6750.

The OPA rego policy in test_authorization_services.py was constructing malformed Authorization headers using concat(" ", ["Bearer ", token]). Since OPA's concat joins array elements with the separator, and "Bearer " already has a trailing space, this produced "Bearer <token>" (double space).
The old Keycloak parser was lenient and accepted this; the new parser rejects it.

Verification steps

poetry run pytest -vv testsuite/tests/singlecluster/authorino/authorization/opa/test_authorization_services.py
poetry run pytest -vv --standalone testsuite/tests/singlecluster/authorino/authorization/opa/test_authorization_services.py

…26.5.4+

Signed-off-by: Silvia Tarabova <starabov@redhat.com>
@silvi-t silvi-t merged commit 4fa513a into Kuadrant:main Mar 25, 2026
4 checks passed
@silvi-t silvi-t deleted the keycloak-rego-fix branch March 27, 2026 08:55
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.

3 participants