Skip to content

[HOTFIX] Strip quotes from LDAP role names and fix defaultRole example - #5609

Open
paul8263 wants to merge 1 commit into
apache:masterfrom
paul8263:ZEPPELIN-6295-fix
Open

paul8263 wants to merge 1 commit into
apache:masterfrom
paul8263:ZEPPELIN-6295-fix

Conversation

@paul8263

@paul8263 paul8263 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Shiro's Ini parser keeps quotes for String properties, so ldapRealm.defaultRole = "role1,role2" produced the role names "role1 and role2". Strip surrounding quotes when resolving role names, and correct the Javadoc example to show an unquoted defaultRole. Quotes are still required for rolesByUsername values that contain a comma.

Add tests for quoted defaultRole and rolesByUsername values, including the shiro.ini parsing path.

What is this PR for?

This is a follow-up fix to ZEPPELIN-6295. Shiro's Ini parser does not strip quotes from String properties, so configuring ldapRealm.defaultRole = "role1,role2" passed the literal value "role1,role2" to setDefaultRole(). After splitting on commas, the realm returned the role names "role1 and role2" (including the quote characters), so role checks such as subject.hasRole("role1") failed.

This PR strips surrounding quotes from each resolved role name, corrects the Javadoc example to use an unquoted defaultRole, and documents that quotes are still required for rolesByUsername values containing a comma because the map entries themselves are comma-separated. Regression tests cover quoted and unquoted configurations, including the actual shiro.ini parsing path.

What type of PR is it?

Hot fix

Todos

What is the Jira issue?

[ZEPPELIN-6295]

How should this be tested?

Run the affected unit tests:
./mvnw test -pl zeppelin-server -am -Dtest=RoleMappingLdapRealmTest

Screenshots (if appropriate)

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

Shiro's Ini parser keeps quotes for String properties, so
`ldapRealm.defaultRole = "role1,role2"` produced the role names `"role1`
and `role2"`. Strip surrounding quotes when resolving role names, and
correct the Javadoc example to show an unquoted defaultRole. Quotes are
still required for rolesByUsername values that contain a comma.

Add tests for quoted defaultRole and rolesByUsername values, including the
shiro.ini parsing path.

This branch has not been deployed

No deployments
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.

1 participant