Repository navigation
[#2924] - WildcardPermission and DomainPermission lower-case with the JVM default locale - #2925
Merged
Merged
Conversation
…th the JVM default locale WildcardPermission (default case-insensitive mode) and DomainPermission.getDomain() lower-cased with String.toLowerCase(), which follows the JVM default locale. Under a Turkish default locale "ADMIN:*" no longer implied "admin:read" and InvoicePermission derived the domain "ınvoice" (dotless i). DefaultWebSessionManager looked up the JSESSIONID URL parameter the same way. Use Locale.ENGLISH, as the SHIRO-415 and SHIRO-483 fixes did, and add an @isolated test (the test suite runs methods concurrently) that checks permission matching under a tr-TR default locale.
…andling across different locales
lprimak
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #2924
What happened:
WildcardPermission.setPartsimplements the default case-insensitive mode withwildcardString.toLowerCase(), andDomainPermission.getDomainderives the domain withclazz.getSimpleName().toLowerCase(). Both follow the JVM default locale. On a JVM whose default locale is Turkish (tr-TR— the default on any Turkish OS/user account;-Duser.language=tr -Duser.country=TRreproduces it anywhere) an uppercaseIlower-cases to a dotlessı(U+0131), so the "case-insensitive" comparison is no longer case-insensitive for any token containingI/i:Under
en-USevery line istrue/invoice. Permission strings are machine-read (realm data,@RequiresPermissions,isPermitted(...)), so a grant stored asADMIN:*silently stops matchingadmin:read, and anyDomainPermissionsubclass with a capitalIin its name (InvoicePermission,InventoryPermission, …) never matches its configured domain.This is the same class of bug fixed in SHIRO-415 (
"BASIC".toLowerCase()inisLoginAttempt) and SHIRO-483 (passwordsMatchunder tr_TR); those fixes usedLocale.ENGLISH, as doHttpAuthenticationFilter,SimpleCookieand the hash-format classes today. Secondary site with the same shape:DefaultWebSessionManagerlooks for theJSESSIONIDURL parameter vianame.toLowerCase()(jsessıonıdunder tr-TR).How to reproduce: run the snippet above (or any
WildcardPermissioncheck with anIin a token) with-Duser.language=tr -Duser.country=TR.Expected: case-insensitive permission matching independent of the host locale.
Versions: 3.0.1 (and
main); any JDK.Fix:
toLowerCase(Locale.ENGLISH)atWildcardPermission.java:158andDomainPermission.java:98(+DefaultWebSessionManager), with a test that sets the default locale totr-TRaround aWildcardPermission("ADMIN:*").implies(new WildcardPermission("admin:read"))check. I have the change ready.mvn verifyrun oncore(JDK 21); the newPermissionDefaultLocaleTestis@Isolatedbecause the suite runs methods concurrently.