Skip to content

Validate file upload resource constraints server-side - #1516

Merged
reiern70 merged 1 commit into
apache:masterfrom
M0nd0R:agent/upload-token-fix
Jul 14, 2026
Merged

Validate file upload resource constraints server-side#1516
reiern70 merged 1 commit into
apache:masterfrom
M0nd0R:agent/upload-token-fix

Conversation

@M0nd0R

@M0nd0R M0nd0R commented Jul 14, 2026

Copy link
Copy Markdown

Summary

This change stops FileUploadToResourceField from trusting client-controlled upload limit parameters.

Root Cause

The upload resource accepted maxSize, fileMaxSize, and fileCountMax directly from the request URL. A client could tamper with those values and relax the server-side limits that were rendered by the component.

Fix

Render a signed uploadToken alongside the configured limits and reject uploads when the submitted limits do not match the signed values.

Validation

  • mvn -pl wicket-core-tests -am -Dtest=org.apache.wicket.markup.html.form.upload.resource.FileUploadToResourceFieldSecurityTest -Dsurefire.failIfNoSpecifiedTests=false clean test

@reiern70

Copy link
Copy Markdown
Contributor

@M0nd0R thanks for the PR... I will review ASAP and test our app, that uses this functionality, still works.

@reiern70
reiern70 self-requested a review July 14, 2026 16:11

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

LGTM. Thanks!

@reiern70
reiern70 merged commit 483b83c into apache:master Jul 14, 2026
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