[java-idp-oidc] 03/03: JCOMOIDC-167 - Update Nimbus oauth2-oidc-sdk into the latest v11
Codeberg
noreply at shibboleth.net
Wed Nov 25 12:36:11 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-idp-oidc.
View the commit online:
https://codeberg.org/Shibboleth/java-idp-oidc/commit/4e24cf2b4887f094bf50083f1857b445492be505
commit 4e24cf2b4887f094bf50083f1857b445492be505
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Wed Nov 25 14:35:24 2026 +0200
JCOMOIDC-167 - Update Nimbus oauth2-oidc-sdk into the latest v11
https://shibboleth.atlassian.net/browse/JCOMOIDC-167
Exploit Nimbus for the query parameter check
---
.../impl/OAuth2IntrospectionRequestDecoder.java | 7 ++-----
.../impl/OAuth2IntrospectionRequestDecoderTest.java | 19 +++++++++++++++++++
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoder.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoder.java
index 0288aeb5..e30f2000 100644
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoder.java
+++ b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoder.java
@@ -29,7 +29,6 @@ import com.nimbusds.oauth2.sdk.http.JakartaServletUtils;
import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.plugin.oidc.op.decoding.impl.RequestUtil;
import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.primitive.StringSupport;
/**
* Message decoder decoding OpenID Connect {@link TokenIntrospectionRequest}s.
@@ -45,15 +44,13 @@ public class OAuth2IntrospectionRequestDecoder extends BaseOAuth2RequestDecoder<
protected TokenIntrospectionRequest parseMessage() throws MessageDecodingException {
try {
final HttpServletRequest httpServletRequest = getHttpServletRequest();
- final String query = httpServletRequest != null ?
- StringSupport.trimOrNull(httpServletRequest.getQueryString()) : null;
+ final HTTPRequest httpReq = JakartaServletUtils.createHTTPRequest(httpServletRequest);
// the spec mandates token to be sent in application/x-www-form-urlencoded data
// Nimbus allows the use of query parameters too, so we deny it by ourselves
- if (query != null && query.contains("token=")) {
+ if (httpReq.getQueryStringParameters().containsKey("token")) {
log.error("The query parameters contain 'token'");
throw new MessageDecodingException("The query parameters contain 'token'");
}
- final HTTPRequest httpReq = JakartaServletUtils.createHTTPRequest(httpServletRequest);
getProtocolMessageLogger().trace("Inbound request {}", RequestUtil.toString(httpReq));
return TokenIntrospectionRequest.parse(httpReq);
} catch (final com.nimbusds.oauth2.sdk.ParseException | IOException e) {
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoderTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoderTest.java
index 3214a0a0..8fb8f2cd 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoderTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/decoding/impl/OAuth2IntrospectionRequestDecoderTest.java
@@ -74,4 +74,23 @@ public class OAuth2IntrospectionRequestDecoderTest {
decoder.decode();
}
+ @Test(expectedExceptions = MessageDecodingException.class)
+ public void testEncodedTokenInQueryParams() throws MessageDecodingException {
+ httpRequest.setQueryString("one=value&%74oken=another");
+ decoder.decode();
+ }
+
+ @Test
+ public void testAccessTokenInQueryParams() throws MessageDecodingException {
+ httpRequest.setQueryString("one=value&access_token=another");
+ decoder.decode();
+ final MessageContext messageContext = decoder.getMessageContext();
+ assert messageContext != null;
+ if (messageContext.getMessage() instanceof TokenIntrospectionRequest request) {
+ Assert.assertEquals(request.getToken().toString(), "45ghiukldjahdnhzdauz");
+ } else {
+ Assert.fail();
+ }
+ }
+
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list