Repository navigation
Check a salt that was read from an upload with parse errors - #339
Merged
Merged
Conversation
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.
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
reviewed
Nov 20, 2026
snoopdave
left a comment
Contributor
There was a problem hiding this comment.
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.
snoopdave
approved these changes
Nov 20, 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.
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.
ValidateSaltInterceptornow 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
ValidateSaltInterceptorTestcases check that a valid salt read despite parse errors is consumed and the action returnsinput, and that an invalid one is refused.A further review pass added these fixes: