-
-
Notifications
You must be signed in to change notification settings - Fork 8k
fix(common): introduce magic file type validator to nestjs common #14881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(common): introduce magic file type validator to nestjs common #14881
Conversation
Pull Request Test Coverage Report for Build c6d89f19-7909-4729-a795-fc3ab4be8c81Details
💛 - Coveralls |
Instead of introducing a new validator, we should probably just replace the logic of the existing one; otherwise we won't get rid of the vulnerability report |
c8c56ac
to
54f5b80
Compare
@kamilmysliwiec I'm not sure why the test suddenly started failing. it passes on local env 😕 |
|
@kamilmysliwiec I used a new package and refactored the code to support the file validation without magic numbers as well due to lack of file type support with magic numbers file type validation. The default behaviour is validated with magic numbers to fix the security vulnerability. |
Thanks @Chathula. I'm not sure if adding a hard dependency on package that has 20k/week downloads is safe though |
Yes. I agree. What are our options? This |
Is there any specific reason why eval-workaround doesn't work? |
97f3823
to
3ff9024
Compare
because we need to pass |
@kamilmysliwiec I used the file type package with eval Import. Let's see whether this is good to go or not. |
@kamilmysliwiec let me know if there is anything that I need to do to merge this one. |
@kamilmysliwiec moved the changes back |
LGTM |
Would you like to create an identical PR that targets the v10.4.15 branch? |
sure I can do it |
@kamilmysliwiec i created branch for v10.4.15 to target in my fork. but I can't see a branch for v10.4.15 here is my branch: https://github.com/Chathula/nest/tree/fix-nest-common-mime-validator |
PR filed: #14948 |
New version of the FileTypeValidator implemented in nestjs/nest#14881 no longer has a limitation that the file contents are removed. This updates the documentation to match.
FileTypeValidator
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Bugfix
Feature
Code style update (formatting, local variables)
Refactoring (no functional changes, no api changes)
Build related changes
CI related changes
Other... Please describe:
security enhancement fix
What is the current behavior?
Issue Number: N/A
What is the new behavior?
addMagicFileTypeValidator
pipe method instead ofaddFileTypeValidator
pipe to more secure mime type validationDoes this PR introduce a breaking change?
Other information