-
Notifications
You must be signed in to change notification settings - Fork 48
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
Validation of file types #573
Validation of file types #573
Conversation
✅ Tests will run for this PR. Once they succeed it can be merged. |
apps/api/src/common/files.ts
Outdated
const mimeAllowlist = [ | ||
'text/plain', | ||
'application/json', | ||
'image/png', | ||
'image/jpeg', | ||
'application/xml', | ||
'text/xml', | ||
'application/msword', | ||
'application/vnd.ms-excel', | ||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a pdf as allowed too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Closes #515
This PR provides mechanism to validate the file type uploaded to the backend. I added two types of validation , since using only the extension is not secure enough. Now we will support the following extension and mime types:
Motivation and context
Testing
Tried to upload one valid and invalid file:
Failed with:
Allowed mime type and not allowed extension: