Skip to content

[GEODE-10699] Upgrade Shiro to 3.0.2 from 3.0.0 - #8153

Open
hesitationkills wants to merge 2 commits into
apache:developfrom
hesitationkills:feature/GEODE-10699
Open

hesitationkills wants to merge 2 commits into
apache:developfrom
hesitationkills:feature/GEODE-10699

Conversation

@hesitationkills

@hesitationkills hesitationkills commented Nov 20, 2026 •

Copy link
Copy Markdown

Upgraded Shiro from 3.0.0 to 3.0.2, bumped slf4j-api to 2.0.20 as required by Shiro, and fixed a previous missing upgrade of shiro-core in boms/geode-all-bom/src/test/resources/expected-pom.xml

For all changes, please confirm:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
  • Has your PR been rebased against the latest commit within the target branch (typically develop)?
  • Is your initial contribution a single, squashed commit?
  • Does gradlew build run cleanly?
  • Have you written or updated unit tests to verify your changes?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

@JinwooHwang
JinwooHwang self-requested a review November 20, 2026 21:15

@JinwooHwang JinwooHwang 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.

Welcome to Apache Geode, @hesitationkills, and congratulations on your first contribution! Thank you for picking this up.

Keeping Shiro current matters a lot for a security-sensitive dependency, and this is a clean, well-scoped upgrade: the version constraint in DependencyConstraints.groovy and the expected classpath listings all move together in a single commit, with the JIRA ticket referenced in the title. That is exactly how we like to see dependency upgrades done.

I especially appreciate that you caught the stale shiro-core entry in boms/geode-all-bom/src/test/resources/expected-pom.xml. It was still at 1.13.0, left behind by an earlier upgrade, and it’s the kind of detail that is easy to overlook even for people who have been in this codebase for years. Fixing it here leaves the project in better shape than you found it.

One small thing before merge: geode-assembly/src/integrationTest/resources/assembly_content.txt still lists lib/shiro-lang-3.0.0.jar (line 1051). The gfsh and server-all classpath files already have shiro-lang-3.0.2.jar, so this one just slipped through, which is easy to do in files this long. Could you update it to 3.0.2 so the assembly content check stays consistent?

Approving with that one-line fix. Thank you again for the care you put into this. We’d love to see more from you, and if you have questions about the codebase or are looking for a next ticket, please reach out on dev@geode.apache.org. Welcome aboard!

@hesitationkills

Copy link
Copy Markdown
Author

Welcome to Apache Geode, @hesitationkills, and congratulations on your first contribution! Thank you for picking this up.

Keeping Shiro current matters a lot for a security-sensitive dependency, and this is a clean, well-scoped upgrade: the version constraint in DependencyConstraints.groovy and the expected classpath listings all move together in a single commit, with the JIRA ticket referenced in the title. That is exactly how we like to see dependency upgrades done.

I especially appreciate that you caught the stale shiro-core entry in boms/geode-all-bom/src/test/resources/expected-pom.xml. It was still at 1.13.0, left behind by an earlier upgrade, and it’s the kind of detail that is easy to overlook even for people who have been in this codebase for years. Fixing it here leaves the project in better shape than you found it.

One small thing before merge: geode-assembly/src/integrationTest/resources/assembly_content.txt still lists lib/shiro-lang-3.0.0.jar (line 1051). The gfsh and server-all classpath files already have shiro-lang-3.0.2.jar, so this one just slipped through, which is easy to do in files this long. Could you update it to 3.0.2 so the assembly content check stays consistent?

Approving with that one-line fix. Thank you again for the care you put into this. We’d love to see more from you, and if you have questions about the codebase or are looking for a next ticket, please reach out on dev@geode.apache.org. Welcome aboard!

@JinwooHwang Thanks for pointing that out. I've updated the commit to upgrade to shiro-lang-3.0.2.jar in assembly_content.txt as well.

@JinwooHwang

Copy link
Copy Markdown
Contributor

You are very welcome @hesitationkills. We appreciate your prompt fix!

@JinwooHwang

Copy link
Copy Markdown
Contributor

Hi @hesitationkills.

The CI failures come from two side effects of Shiro 3.0.2, and both are small to address in this PR:

  1. Logins without a password (token logins, for example)

Shiro 3.0.2 no longer matches empty credentials in its default matcher. In Geode the SecurityManager has already validated the login at that point, so CustomAuthRealm should set its matcher explicitly. In geode-core/src/main/java/org/apache/geode/internal/security/shiro/CustomAuthRealm.java:

import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
...
public CustomAuthRealm(SecurityManager securityManager) {
  this.securityManager = securityManager;
  setAuthenticationTokenClass(GeodeAuthenticationToken.class);
  setCredentialsMatcher(new AllowAllCredentialsMatcher());
}
  1. slf4j-api version

Shiro 3.0.2 brings in slf4j-api 2.0.20, so the distribution ends up with two copies. Please bump it from 2.0.18 to 2.0.20 in:

  • DependencyConstraints.groovy (slf4j-api.version)
  • boms/geode-all-bom/src/test/resources/expected-pom.xml
  • geode-assembly/src/integrationTest/resources/assembly_content.txt
  • geode-assembly/src/integrationTest/resources/gfsh_dependency_classpath.txt
  • geode-server-all/src/integrationTest/resources/dependency_classpath.txt

Happy to help if anything is unclear. Thanks again for the contribution!

@gouthamaenugu gouthamaenugu 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.

I checked out commit 3d6c417418 locally under Temurin JDK 17 and reproduced the CI failures across :geode-web-management:integrationTest and :geode-assembly:integrationTest. There are two distinct root causes behind the failing jobs:

1. Shiro 3.0.2 rejects empty credentials in SimpleCredentialsMatcher (RequestWithAuthTokenTest.pingWithValidToken fails with 401)

  • Reproduced failure: :geode-web-management:integrationTest (67 tests, 1 failed) fails at RequestWithAuthTokenTest.java:58 (Status expected:<200> but was:<401>). SimpleSecurityManager.authenticate() logs Token authentication SUCCESS - returning principal: Bearer FOO_BAR, immediately followed by IntegratedSecurityService.java:179 logging error logging in:.
  • Root cause: Comparing org.apache.shiro.authc.credential.SimpleCredentialsMatcher.equals(Object, Object) bytecode (javap -c) between shiro-core-3.0.0.jar and shiro-core-3.0.2.jar, Shiro 3.0.2 added a guard at offsets 0..22 returning false whenever accountCredentials == null or isByteSource(accountCredentials) && toBytes(accountCredentials).length == 0.
  • Because GeodeAuthenticationToken (geode-core/src/main/java/org/apache/geode/internal/security/shiro/GeodeAuthenticationToken.java:30-35) defaults a missing security-password (e.g., Bearer token or passwordless custom SecurityManager auth) to "" (char[0]), and CustomAuthRealm (geode-core/src/main/java/org/apache/geode/internal/security/shiro/CustomAuthRealm.java:44-55) inherits AuthorizingRealm's default SimpleCredentialsMatcher despite already authenticating via securityManager.authenticate(authToken.getProperties()) at line 53, every token/passwordless login now fails credential matching.
  • Verified 1-line fix: Set AllowAllCredentialsMatcher in CustomAuthRealm's constructor (CustomAuthRealm.java:46-47):
    import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
    ...
    setAuthenticationTokenClass(GeodeAuthenticationToken.class);
    setCredentialsMatcher(new AllowAllCredentialsMatcher());
    Verified locally on 3d6c417418: RequestWithAuthTokenTest flips from 401 failure to 2/2 passing (BUILD SUCCESSFUL).

2. Transitive slf4j-api version bump (2.0.18 -> 2.0.20) breaks assembly & gfsh classpath checks

  • Reproduced failures:
    • AssemblyContentsIntegrationTest.verifyAssemblyContents (AssemblyContentsIntegrationTest.java:67): unexpected ["lib/slf4j-api-2.0.20.jar"] vs geode-assembly/src/integrationTest/resources/assembly_content.txt:1052 (lib/slf4j-api-2.0.18.jar).
    • GfshDependencyJarIntegrationTest.verifyManifestClassPath (GfshDependencyJarIntegrationTest.java:67): missing ["slf4j-api-2.0.18.jar"], unexpected ["slf4j-api-2.0.20.jar"] vs geode-assembly/src/integrationTest/resources/gfsh_dependency_classpath.txt:118.
  • Root cause: Shiro 3.0.2 pulls in org.slf4j:slf4j-api:2.0.20, overriding the soft BOM constraint deps.put("slf4j-api.version", "2.0.18") (DependencyConstraints.groovy:60, :234) in geode-assembly. Meanwhile :geode-server-all uses enforcedPlatform (geode-server-all/build.gradle:33), leaving geode-assembly (2.0.20) and geode-server-all (2.0.18) out of sync.
  • Fix: Either bump slf4j-api.version to 2.0.20 in DependencyConstraints.groovy:60 and update boms/geode-all-bom/src/test/resources/expected-pom.xml:423, assembly_content.txt:1052, gfsh_dependency_classpath.txt:118, and geode-server-all/src/integrationTest/resources/dependency_classpath.txt:119, or strictly pin slf4j-api to 2.0.18.

(:boms:geode-all-bom:check and :geode-core:integrationTest --tests "*Shiro*" already pass locally.)

@JinwooHwang

Copy link
Copy Markdown
Contributor

Thanks @gouthamaenugu, I really appreciate you taking the time to reproduce this locally on JDK 17. Independent confirmation of both root causes, and that AllowAllCredentialsMatcher resolves the token-login 401, is very helpful.

On slf4j-api, I'd prefer bumping to 2.0.20 across the affected files rather than pinning to 2.0.18, so we stay aligned with what Shiro 3.0.2 brings in.

@hesitationkills, once those two changes are pushed, I'll be happy to re-review. Thanks again to you both!

… align with Shiro's dependency version, and setting AllowAllCredentialsMatcher for CustomAuthRealm
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