Skip to content

Fix executor permitted-resources test to use registered resource URI#1482

Closed
Copilot wants to merge 5 commits intoISSUE-41527from
copilot/improve-issue-41527-implementation
Closed

Fix executor permitted-resources test to use registered resource URI#1482
Copilot wants to merge 5 commits intoISSUE-41527from
copilot/improve-issue-41527-implementation

Conversation

Copy link

Copilot AI commented Feb 28, 2026

Description

testExecutorWithPermittedResources had a bug: it used an unregistered resource URI to test the SecureResourceIndicatorExecutor's permitted-resources rejection. This can never work because AuthorizationEndpointChecker.checkResourceIndicator() runs before client policy executors and rejects unknown URIs with INVALID_TARGET — the executor never executes.

Authorization endpoint flow:
  1. checker.checkResourceIndicator()  ← rejects unknown URIs (INVALID_TARGET)
  2. clientPolicy().triggerOnEvent()    ← executor checks permitted resources (INVALID_REQUEST)

The test expected INVALID_REQUEST / ERR_NOT_PERMITTED_RESOURCE from the executor, but would get INVALID_TARGET / "Invalid resource indicator: ..." from the endpoint checker.

Fix: Use RESOURCE_SERVER_URI_2 (registered client, passes endpoint check) instead of a fabricated URL, and restrict permittedResources to only RESOURCE_SERVER_URI so the executor properly rejects the second URI.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • repo.gradle.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/keycloak/keycloak org.codehaus.plexus.classworlds.launcher.Launcher compile -pl services -am -DskipTests -q (dns block)
  • repository.jboss.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/keycloak/keycloak org.codehaus.plexus.classworlds.launcher.Launcher compile -pl services -am -DskipTests -q (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/keycloak/keycloak org.codehaus.plexus.classworlds.launcher.Launcher compile test-compile -pl tests/base -am -DskipTests -q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 28, 2026 15:14
…-in mapper

Per @stianst's feedback in PR keycloak#35711:
- Add resource.indicator.uri client attribute to OIDCConfigAttributes
- Transform ResourceIndicatorMapper to a built-in mapper that validates
  resource indicators against client attributes and role scope
- Register mapper in default roles scope (like AudienceResolveProtocolMapper)
- Add validation at authorization endpoint (checkResourceIndicator)
- Add INVALID_TARGET error code per RFC 8707
- Remove SecureResourceIndicatorExecutor (validation is now built-in)
- Rewrite tests to use client attribute + role scope approach

Co-authored-by: tnorimat <25092005+tnorimat@users.noreply.github.com>
…ty to public

Co-authored-by: tnorimat <25092005+tnorimat@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance RFC 8707 resource indicator support in Keycloak RFC 8707: Replace mapper+executor approach with client attribute + built-in mapper Feb 28, 2026
Bring back the SecureResourceIndicatorExecutor and its factory which
provide the "permitted resources" client policy feature. This allows
admins to restrict which resource indicator values are allowed via
client policies, and ensures token request consistency checks.

The executor works alongside the built-in ResourceIndicatorMapper:
- Mapper: resolves resource URIs to audience claims via client attributes
- Executor: enforces permitted resources and token request consistency

Co-authored-by: tnorimat <25092005+tnorimat@users.noreply.github.com>
Copilot AI changed the title RFC 8707: Replace mapper+executor approach with client attribute + built-in mapper RFC 8707: Resource indicator support via client attribute + built-in mapper with executor policy enforcement Feb 28, 2026
…or executor check

The test used an unregistered resource URI ("https://different.resource.example.com/")
to test the executor's permitted-resources rejection. However,
AuthorizationEndpointChecker.checkResourceIndicator() runs BEFORE the executor and
rejects unknown URIs with INVALID_TARGET error. The executor never gets a chance to run.

Fix: Use RESOURCE_SERVER_URI_2 (which IS registered with a client but NOT in the
permitted resources list) so checkResourceIndicator() passes and the executor
can properly validate against the permitted resources.

Co-authored-by: tnorimat <25092005+tnorimat@users.noreply.github.com>
Copilot AI changed the title RFC 8707: Resource indicator support via client attribute + built-in mapper with executor policy enforcement Fix executor permitted-resources test to use registered resource URI Feb 28, 2026
@tnorimat tnorimat closed this Mar 2, 2026
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.

2 participants