Repository navigation
Serve a media file only at its own weblog's address - #308
Merged
Merged
Conversation
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.
This was referenced Nov 17, 2026
snoopdave
reviewed
Nov 18, 2026
snoopdave
left a comment
Contributor
There was a problem hiding this comment.
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.
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MediaResourceServletlooks 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.
MediaResourceServletTestcovers 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 testpasses (752 tests).