Skip to content

Don't start a session for Roller UI stylesheets, scripts and images - #310

Merged
mraible merged 2 commits into
masterfrom
no-salt-for-static-files
Nov 18, 2026
Merged

mraible merged 2 commits into
masterfrom
no-salt-for-static-files

Conversation

@mraible

@mraible mraible commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

LoadSaltFilter runs for every request under /roller-ui, except weblog rendering requests. So an anonymous visitor's request for a stylesheet, script or image under /roller-ui/styles, /roller-ui/scripts, /roller-ui/images or /roller-ui/theme (such as the front-page tab images) started a session (a JSESSIONID cookie) and added an unused form salt to the salt cache. It now skips those paths, as it skips /roller-ui/rendering/.

Together with #300, which takes those paths out of the Spring Security chain, Roller's UI static files can be cached.

  • LoadSaltFilterTest checks that the four kinds of static file get no session and no salt and are still passed on to the rest of the filter chain; other /roller-ui pages still get a salt, including /roller-ui/styles-settings.rol, which only shares a prefix with a static directory.
  • On jetty:run, roller.css, date-fields.js and feather.svg come back without Set-Cookie, while the login page still sets one.
  • mvn test passes.

LoadSaltFilter started a session and put a form salt in the cache for every request under /roller-ui, including the static files in /roller-ui/styles, /roller-ui/scripts and /roller-ui/images. It now skips those, as it skips weblog rendering requests.

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

Review of 4bfd8d2fa: The new test would catch the original session behavior for the three listed directories. The front page also uses images under /roller-ui/theme/, which this patch still routes through session creation. Compared with twin #332, this PR omits two test checks.

…iles still reach the filter chain

Requests under /roller-ui/theme/, such as the front-page tab images, no longer create a session. The test now covers that directory, checks that every static request is passed on to the rest of the chain, and checks that /roller-ui/styles-settings.rol, which only shares a prefix with a static directory, still gets a salt.

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

LGTM

@mraible
mraible merged commit 333f37b into master Nov 18, 2026
9 checks passed
@mraible
mraible deleted the no-salt-for-static-files branch November 18, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants