Skip to content

Fix/file upload security#31

Merged
nehabagdia merged 11 commits into
mainfrom
fix/file_upload_security
Mar 1, 2024
Merged

Fix/file upload security#31
nehabagdia merged 11 commits into
mainfrom
fix/file_upload_security

Conversation

@gaya3-vijayakumar

@gaya3-vijayakumar gaya3-vijayakumar commented Feb 29, 2024

Copy link
Copy Markdown
Contributor

What

  • Validation added for file upload is eating away bytes from the file uploaded
  • mypy issues

Why

Validation is reading a few bytes to understand the mime type and the file pointer is not reset. Because of this bytes are lost

How

Reset the file pointer to the start of the file

Relevant Docs

Related Issues or PRs

Dependencies Versions / Env Variables

Notes on Testing

...

Screenshots

...

Checklist

I have read and understood the Contribution Guidelines.

Comment thread backend/file_management/serializer.py
Comment thread backend/utils/FileValidator.py
Comment thread backend/utils/FileValidator.py
Comment thread backend/utils/FileValidator.py
Comment thread backend/utils/FileValidator.py

@muhammad-ali-e muhammad-ali-e left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the functionality. Minor coments are added.

@nehabagdia
nehabagdia merged commit b8ef3e4 into main Mar 1, 2024
@nehabagdia
nehabagdia deleted the fix/file_upload_security branch March 1, 2024 04:58
pk-zipstack pushed a commit that referenced this pull request Aug 20, 2025
* Add file upload validation

* Code formatting

* Code formatting

* Change values to constants

* Remove unwanted import

* Set file pointer to the beginning of the file

* Set pointer to the beginning of the file
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

Successfully merging this pull request may close these issues.

4 participants