fix(check uploads content): Check that a client upload's extension matches the file contents #371
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.
Purpose
This remediates a finding where a user could upload a file that has an extension that doesn't match its contents; the example was a jpg containing xml with embedded javascript
Linked Issues to Close
Closes https://qmacbis.atlassian.net/browse/OY2-26965
Approach
Please access the ticket above for more information. This PR will deliberately refrain from listing all contents of the ticket in this PR.
This finding calls for a way to verify a file's extension against its contents. We decided the best, and most secure, way to do that is to check it server side. Here's how it works:
How to test
We were provided the file that was used in the finding. It is named as a jpg but contains xml embedded with javascript.
As part of testing:
Assorted Notes/Considerations/Learning
None