Escape special characters in form field names #7033
Merged
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.
Rationale
Certain "special" characters (e.g.,
" ; = , \) can cause issues when not escaped inmultipart/form-datain Tomcat. For example, the "name" of the property is extracted from:form-data; name="field\"; filename="spread.xlsx";is expected to be
field\, however, it is parsed asfield\"; filename="spread.xlsx";because the backlash is recognized as escaping the"afterfield\. The fix is to escape the backslash like this:form-data; name="field\\"; filename="spread.xlsx";Unfortunately, it is not clear to me why we need to do this as it seems like the standard states that as long as the string is quoted (e.g.,
name"field\";notname=field\;) which appears to be what we are receiving. This fix is currently targeted only forQueryUpdateFormwhich is used for our standard query insert/update forms.Related Pull Requests
Changes
QueryUpdateForm.getFormFieldName()andgetColumnByFormFieldName()to escape and account for special characters in form field names.QueryUpdateForm.getMultiPartFormFieldName()to make use ofgetFormFieldName()to get appropriate escaping.EscapeUtils.getFormFieldName().Tasks 📍