Skip to content
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

Project files: validate mime before storing the file #361

Open
martastain opened this issue Sep 25, 2024 · 0 comments
Open

Project files: validate mime before storing the file #361

martastain opened this issue Sep 25, 2024 · 0 comments
Assignees

Comments

@martastain
Copy link
Member

Story

File mimetype is now parsed only from the upload request header and then validated after the file is uploaded. We could check the file header as soon the first chunk arrives and abort the upload if the file is not supported

Problems

Files won't be uploaded to the project storage if they are not supported - this should be used for reviewables, not comment attachments.

Proposal

additional callable argument to ProjectStorage.handle_upload, that would accept a sequence of bytes and raise an exception if it does not match a valid signature. handle_upload would call this function as soon, there's enough bytes in the buffer to check the file header, before committing the chunk to the storage.

@martastain martastain added the type: enhancement Improvement of existing functionality or minor addition label Sep 25, 2024
@martastain martastain self-assigned this Sep 25, 2024
@martastain martastain removed the type: enhancement Improvement of existing functionality or minor addition label Nov 6, 2024
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

No branches or pull requests

1 participant