Skip to content

[#2975] - User [urls] rules take precedence over framework INI rules - #2976

Open
lprimak wants to merge 1 commit into
apache:mainfrom
lprimak:ini-merge-urls-precedence
Open

lprimak wants to merge 1 commit into
apache:mainfrom
lprimak:ini-merge-urls-precedence

Conversation

@lprimak

@lprimak lprimak commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

When a framework INI is merged into the user INI, the user's [urls] rules now come first, followed by the rules only the framework has. The first matching rule wins, so before this change a framework rule could take over a path the user had configured. [main] keeps the framework definitions first, so the user configuration can still refer to them.

  • IniWebEnvironment.mergeIni reorders the merged [urls] section. Where both files define a pattern, the user's value is kept, as before.
  • The getFrameworkIni() javadoc now describes the order of [main] and [urls].
  • Added a test for the merged order and the resulting filter chains.

fixes #2975

Following this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GitHub issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a GitHub issue. Your pull request should address just this issue, without pulling in other changes.
  • Format the pull request title like [#XXX] - Fixes bug in SessionManager,
    where you replace #XXX with the appropriate GitHub issue. Best practice
    is to use the GitHub issue title in the pull request title and in the first line of the commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • add fixes #XXX if merging the PR should close a related issue.
  • Run mvn verify to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • Committers: Make sure a milestone is set on the PR
  • Committers: Use "Squash and Merge" to combine all commits into one when merging a PR when appropriate.

Trivial changes like typos do not require a GitHub issue (javadoc, comments...).
In this case, just format the pull request title like [DOC] - Add javadoc in SessionManager.

If this is your first contribution, you have to read the Contribution Guidelines

If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement
if you are unsure please ask on the developers list.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@lprimak lprimak added this to the 3.1.0 milestone Nov 25, 2026
@lprimak lprimak added the web label Nov 25, 2026
@github-actions github-actions Bot added java Pull requests that update Java code tests groovy labels Nov 25, 2026
@lprimak lprimak self-assigned this Nov 25, 2026
@lprimak
lprimak requested review from fpapon and a balanced review from Copilot November 25, 2026 22:34

Copilot AI 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.

🟢 Approval recommended

There are no active review issues for the user-first URL-rule precedence change.

No open issues 🎉

What changed in this PR

Fixes #2975 by giving user-defined [urls] rules precedence over framework rules, matching Shiro’s first-match routing behavior while preserving framework-first [main] definitions.

Changes:

  • Orders user URL rules before framework-only rules, retaining user values for shared patterns.
  • Documents section ordering and the effect of user catch-all rules.
  • Adds a regression test for merged URL order, duplicate-pattern values, and filter-chain order.
File Description
web/​src/​test/​groovy/​org/​apache/​shiro/​web/​env/​IniWebEnvironmentTest.groovy Tests user-first URL merging and resulting filter-chain order.
web/​src/​main/​java/​org/​apache/​shiro/​web/​env/​IniWebEnvironment.java Reorders merged URL rules and documents precedence.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

groovy java Pull requests that update Java code tests web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] User [urls] rules don't take precedence over framework INI rules

2 participants