Skip to content

[OID4VCI-FAPI2] Pass fapi2-security-profile-final-dpop-negative-tests#50125

Open
tdiesler wants to merge 1 commit into
keycloak:mainfrom
tdiesler:ghi48070
Open

[OID4VCI-FAPI2] Pass fapi2-security-profile-final-dpop-negative-tests#50125
tdiesler wants to merge 1 commit into
keycloak:mainfrom
tdiesler:ghi48070

Conversation

@tdiesler

Copy link
Copy Markdown
Contributor

closes #48070

closes keycloak#48070

Signed-off-by: Thomas Diesler <tdiesler@proton.me>
@tdiesler tdiesler requested a review from a team as a code owner June 18, 2026 14:32
Copilot AI review requested due to automatic review settings June 18, 2026 14:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Keycloak’s DPoP validation and OID4VC test utilities to satisfy the FAPI2 “final DPoP negative tests” expectations (issue #48070), tightening proof/JWK validation and aligning HTTP URI matching behavior.

Changes:

  • Extend OID4VC wallet test helper API to allow sending dpop_jkt on authorization requests.
  • Normalize DPoP htu comparison by stripping URI fragments (in addition to query) to match expected DPoP URL processing.
  • Harden DPoP proof header/JWK validation by rejecting missing alg and rejecting private-key material (d) in the embedded JWK.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tests/base/src/test/java/org/keycloak/tests/oid4vc/OID4VCBasicWallet.java Adds a fluent helper to set dpop_jkt on authorization requests in OID4VC tests.
services/src/main/java/org/keycloak/services/util/DPoPUtil.java Tightens DPoP validation (URI normalization, alg presence check, reject JWK private-key parameter d).

}
if (key.getPrivateKey() != null) {
throw new VerificationException("Private key is present in DPoP header");
// [TODO >>>] JWKSUtils.getKeyWrapper never seems to extract the private key. Should that be changed?
Comment on lines 107 to +109
private static URI normalize(URI uri) {
return UriBuilder.fromUri(uri).replaceQuery("").build();
URI normalized = UriBuilder.fromUri(uri).fragment(null).replaceQuery("").build();
return normalized;
Comment on lines +188 to 193
if (header.getAlgorithm() == null) {
throw new VerificationException("Invalid or missing alg in DPoP header: " + header.getAlgorithm());
}

String algorithm = header.getAlgorithm().name();
if (!getDPoPSupportedAlgorithms(session).contains(algorithm)) {
Comment on lines +211 to +212
if (key.getPrivateKey() != null || jwk.getOtherClaims().containsKey("d")) {
throw new VerificationException("Private key parameter 'd' must not be present in DPoP JWK");

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.MultipleTabsLoginTest#expiredAuthenticationAction_expiredCodeExpiredExecution

Keycloak CI - Forms IT (chrome)

org.openqa.selenium.NoSuchElementException: 
no such element: Unable to locate element: {"method":"css selector","selector":"#password\-new"}
  (Session info: chrome=149.0.7827.114)
For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Build info: version: '4.28.1', revision: '73f5ad48a2'
...

Report flaky test

org.keycloak.testsuite.federation.kerberos.KerberosLdapTest#writableEditModeTest

Keycloak CI - Java Distribution IT (windows-latest - temurin - 21)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

org.keycloak.testsuite.federation.kerberos.KerberosLdapTest#usernamePasswordLoginTest

Keycloak CI - Java Distribution IT (windows-latest - temurin - 21)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.keycloak.testsuite.federation.kerberos.AbstractKerberosSingleRealmTest.usernamePasswordLoginTest(AbstractKerberosSingleRealmTest.java:140)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.jboss.arquillian.junit.Arquillian$8$1.invokeMethod(Arquillian.java:319)
	at org.jboss.arquillian.junit.MethodInvoker$1.invoke(MethodInvoker.java:18)
...

Report flaky test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OID4VCI-FAPI2] Pass fapi2-security-profile-final-dpop-negative-tests

3 participants