Skip to content

Check a salt that was read from an upload with parse errors - #339

Merged
mraible merged 2 commits into
masterfrom
check-salt-sent-with-upload-errors
Nov 20, 2026
Merged

mraible merged 2 commits into
masterfrom
check-salt-sent-with-upload-errors

Conversation

@mraible

@mraible mraible commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Follows up #312 from review.

An upload action with multipart parse errors skipped the salt check even when the salt had been read, and left that salt in the cache. ValidateSaltInterceptor now skips the check only when no salt could be read. Otherwise the salt is validated and consumed as for any other multipart post.

Tests: two new ValidateSaltInterceptorTest cases check that a valid salt read despite parse errors is consumed and the action returns input, and that an invalid one is refused.

A further review pass added these fixes:

  • A salt read from an upload with parse errors is checked but not used up, so retrying on the upload page works instead of failing with a security violation.

An upload action with multipart parse errors skipped the salt check even when the salt had been read, and left that salt in the cache. Now the check is skipped only when no salt could be read; otherwise the salt is validated and consumed as for any other multipart post.
@mraible
mraible requested a review from snoopdave November 18, 2026 04:16
The media upload page posts with fetch() and only gets a new salt from the JSON answer. When Struts reports a parse error, the workflow interceptor returns the HTML input page before the action runs, so the page keeps the salt it sent. Consuming that salt made the retry fail with a security violation.

A salt that was read from an upload with parse errors is still checked, and an invalid one is still refused, but it is no longer removed from the cache. Nothing is saved on that path, so the salt stays good for the retry. The tests also assert that a request without a salt leaves the cache alone and isn't marked as validated.

@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 e0177538f: The changed path checks a salt read despite multipart parse errors and keeps a valid salt available for retry. The new tests would fail under the previous behavior. No verified issues found.

No new issues found.

@mraible
mraible merged commit 632fce2 into master Nov 20, 2026
9 checks passed
@mraible
mraible deleted the check-salt-sent-with-upload-errors branch November 20, 2026 00:52
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