Skip to content

Serve a media file only at its own weblog's address - #308

Merged
mraible merged 1 commit into
masterfrom
media-file-own-weblog
Nov 18, 2026
Merged

mraible merged 1 commit into
masterfrom
media-file-own-weblog

Conversation

@mraible

@mraible mraible commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

MediaResourceServlet looks a media file up by its ID. It now also checks that the file belongs to the weblog named in the address (/<handle>/mediaresource/<id>, or /roller-ui/rendering/media-resources/<handle>/<id> behind it) and answers 404 otherwise, the same as for an unknown ID.

Links Roller writes for media files already use the file's own weblog, so they're unaffected.

  • MediaResourceServletTest covers a file at its own weblog's address (served), at another weblog's address (404) and an unknown ID (404). The second case fails without the change.
  • mvn test passes (752 tests).

MediaResourceServlet now answers 404 unless the requested media file belongs to the weblog named in the address.
mraible added a commit to mraible/roller that referenced this pull request Nov 17, 2026
…ached

- A weblog's media addresses under /roller-ui/rendering/media-resources/<handle>/ are checked as if they were the weblog's own path, like its pages and feeds. With apache#308, a media file is only served at its own weblog's address, so the install guide no longer needs its note about media files.
- Roller's own static files (/images, /theme, /webjars, /roller-ui/styles, /roller-ui/scripts, /roller-ui/images) skip the security filter chain, so they're served without Cache-Control: no-store and can be cached. Each path is under a reserved name.

@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 7171e10f8: The servlet checks the media file’s weblog before serving it, and the new test would fail without that check. Twin PR #329 has the same fix, with the expected javax imports instead of jakarta imports. No verified issues were found in this read-only review.

No issues found.

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

Approved.

@mraible
mraible merged commit fe893f6 into master Nov 18, 2026
9 checks passed
@mraible
mraible deleted the media-file-own-weblog branch November 18, 2026 03:38
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.

2 participants