You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "Croway (via GitHub)" <gi...@apache.org> on 2026/09/09 10:01:37 UTC

[PR] [backport camel-spring-boot-4.18.x] CAMEL-24497: camel-undertow-spring-security-starter - validate the JWT issuer and audience [camel-spring-boot]

Croway opened a new pull request, #1954:
URL: https://github.com/apache/camel-spring-boot/pull/1954

   Cherry-pick of #1910 onto `camel-spring-boot-4.18.x`.
   
   **Original PR:** #1910 — camel-undertow-spring-security-starter - validate the JWT issuer and audience
   **JIRA:** [CAMEL-24497](https://issues.apache.org/jira/browse/CAMEL-24497)
   
   ### What it fixes
   
   `jwtDecoderByIssuerUri` built the JWT decoder with `NimbusJwtDecoder.withJwkSetUri` and only attached a claim-set converter, so Spring Security's default validator ran: signatures and timestamps were checked, but the `iss` claim was not, and the configured `clientId` was used solely to build the `ClientRegistration` — it was never bound to the incoming token.
   
   Because every client of a Keycloak realm shares the same signing key, a token minted for any other client of that realm passed the signature check and was accepted by this starter. That's an auth-bypass: a low-trust client's token could be replayed against an endpoint intended for a different, more privileged client of the same realm.
   
   The decoder now installs `JwtValidators.createDefaultWithIssuer` for the realm the client registration already points at, plus a new `JwtAudienceValidator` that binds the token to the configured `clientId` via its `aud` or `azp` claim.
   
   ### Behavior change
   
   This changes acceptance behavior for tokens that were previously accepted despite having the wrong issuer or audience — that is the intended effect of the fix. For deployments that rely on tokens minted for a different client of the same realm, the audience check can be disabled with `camel.security.undertow.keycloak.validate-audience=false` to restore the old tolerance.
   
   ### Verification on this branch
   
   - Cherry-pick of the original commit applied with one conflict: `src/main/doc/intro.adoc` and `docs/spring-boot/modules/ROOT/pages/starters/undertow-spring-security.adoc` were reported as modify/delete conflicts because this module never carried those generated doc files on the `4.18.x` branch (they don't exist in this branch's tree for this starter at all, pre- or post-cherry-pick). Resolved by keeping them deleted (i.e., not reintroducing files that never existed on this branch), matching only the code/test changes from the original commit. This mirrors a throwaway local trial cherry-pick done earlier for validation purposes.
   - Built `camel-undertow-spring-security-starter` and its dependencies: `./mvnw -DskipTests -Dfastinstall install -pl components-starter/camel-undertow-spring-security-starter -am` — BUILD SUCCESS.
   - Ran the module's tests: `cd components-starter/camel-undertow-spring-security-starter && ../../mvnw verify` — `Tests run: 9, Failures: 0, Errors: 0, Skipped: 0` (`JwtAudienceValidatorTest`: 5 tests, `KeycloakIssuerUriTest`: 4 tests), BUILD SUCCESS.
   - The SNAPSHOT parent/`camel-version` were temporarily repointed to the last released `4.18.4` to make the build resolvable locally, then reverted (`git checkout -- pom.xml`) before pushing; `tooling/camel-spring-boot-dependencies/pom.xml` already pins `org.apache.camel` core entries to `4.18.4` on this branch, so no edit was needed there. Catalog files that picked up embedded version strings during the build were discarded with `git checkout -- catalog/`. Final diff against `origin/camel-spring-boot-4.18.x` contains only the 8 files from the cherry-picked commit.
   
   _Claude Code on behalf of Federico Mariani_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [backport camel-spring-boot-4.18.x] CAMEL-24497: camel-undertow-spring-security-starter - validate the JWT issuer and audience [camel-spring-boot]

Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway merged PR #1954:
URL: https://github.com/apache/camel-spring-boot/pull/1954


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org