Skip to content

[ZEPPELIN-5157]Fix Shiro initialization failure when install path has spaces - #5541

Draft
world970511 wants to merge 1 commit into
apache:masterfrom
world970511:ZEPPELIN-5157
Draft

world970511 wants to merge 1 commit into
apache:masterfrom
world970511:ZEPPELIN-5157

Conversation

@world970511

@world970511 world970511 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What is this PR for?

When Zeppelin initializes Shiro authentication, shiroIniPath already contains the actual filesystem path to shiro.ini.
Previously, the path was converted using new File(...).toURI(). This URI conversion percent-encodes special characters in the filesystem path. For example, a path containing a space such as:

/opt/my zeppelin/conf/shiro.ini

is converted to:

/opt/my%20zeppelin/conf/shiro.ini

As a result, Shiro may fail to locate the actual configuration file when the Zeppelin installation path contains spaces or other characters that are encoded during URI conversion.
This PR removes the unnecessary toURI() conversion and constructs the Shiro configuration location by prefixing the original filesystem path with file:.
This preserves the filesystem path as-is and prevents unintended percent encoding.

What type of PR is it?

Bug Fix

Todos

  • Remove unnecessary URI conversion for the Shiro configuration path
  • Preserve the original filesystem path when constructing the file: location
  • Verify behavior with a Zeppelin path containing spaces

What is the Jira issue?

https://issues.apache.org/jira/browse/ZEPPELIN-5157

How should this be tested?

The issue can be reproduced by running Zeppelin from a directory whose path contains spaces.

For example:

/opt/my zeppelin/

  1. Configure Zeppelin to use Shiro authentication.
  2. Place shiro.ini under the Zeppelin configuration directory.
  3. Start Zeppelin from an installation path containing spaces.
  4. Verify that the Shiro configuration file is loaded successfully.

Before this change, the filesystem path could be converted to a percent-encoded URI path such as %20, causing Shiro to fail to locate the configuration file.

After this change, the original filesystem path is passed to Shiro without URI percent encoding.

Screenshots (if appropriate)

N/A

Questions:

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

…s spaces

File#toURI() percent-encodes special characters (e.g. a space becomes
%20) before the resulting string is set as the "shiroConfigLocations"
init param. Shiro's ResourceUtils only strips the "file:" prefix and
passes the remainder directly to FileInputStream without decoding any
URI escaping, so an encoded path never resolves to the real file and
startup fails with a ConfigurationException/FileNotFoundException.

Build the init param from the raw filesystem path instead of going
through toURI(), so no encoding is introduced in the first place.
@world970511
world970511 marked this pull request as draft October 5, 2026 12:08
@world970511 world970511 closed this Oct 5, 2026
@world970511 world970511 reopened this Oct 5, 2026
@world970511 world970511 changed the title [ZEPPELIN-5157] Fix stale Shiro authentication documentation links [ZEPPELIN-5157]Fix Shiro initialization failure when install path has spaces Oct 5, 2026

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