Skip to content

Check the salt of multipart posts that Struts couldn't fully parse - #312

Merged
mraible merged 1 commit into
masterfrom
check-salt-on-multipart-errors
Nov 18, 2026
Merged

mraible merged 1 commit into
masterfrom
check-salt-on-multipart-errors

Conversation

@mraible

@mraible mraible commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ValidateSaltInterceptor skipped the salt check for a multipart post whenever Struts reported errors parsing it, so an upload action could show those errors. In Struts 7, ActionFileUploadInterceptor copies the errors only onto actions that implement UploadedFilesAware; for every other action the post binds its parameters and the action method runs. A multipart post with a field longer than struts.multipart.maxStringLength, sent to a form action that doesn't take uploads, therefore ran that action without a salt.

Now only UploadedFilesAware actions (media add and edit, bookmark import) skip the check. Their errors stop the request in workflow, which returns the input page before the action method runs, as before. Every other action needs a valid salt even when the post has parse errors.

  • ValidateSaltInterceptorTest has a case for a multipart post with parse errors to an action that isn't UploadedFilesAware: it now throws and never invokes the action. It fails without the change. The existing case for upload actions now names an UploadedFilesAware action.
  • On jetty:run, a multipart post to profile!save.rol with no salt and a 5,000-character field is now refused, and a bookmark import with the same field shows the "too long" error and imports nothing.
  • mvn test passes (750 tests), and the Playwright database-login suite passes (20 run, 3 OIDC tests skipped).

The roller-6.1.x line uses Struts 2.5, whose upload interceptor gives parse errors to every action, so this doesn't apply there.

ValidateSaltInterceptor let any multipart post with parse errors through without checking its salt, so that an upload action could report the errors. Struts only gives those errors to upload actions (UploadedFilesAware), though; for any other action the post went on to the action method. Now only upload actions skip the check, and their workflow returns the input page before the action method runs.

@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 adc487c63: The change limits the multipart parse-error exception to upload-aware actions. Static review confirmed that Struts 7.4 passes those errors to Roller's workflow before the save methods run, and the new regression test would fail without the fix. No build was run, as requested.

No issues found.

@mraible
mraible requested a review from snoopdave November 18, 2026 03:21

@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 a6331bf into master Nov 18, 2026
9 checks passed
@mraible
mraible deleted the check-salt-on-multipart-errors branch November 18, 2026 03:37
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