Skip to content

feat: add file size limits and magic bytes validation for CDN upload#921

Open
frankosakwe wants to merge 1 commit into
rinafcode:mainfrom
frankosakwe:feature/file-validation-magic-bytes
Open

feat: add file size limits and magic bytes validation for CDN upload#921
frankosakwe wants to merge 1 commit into
rinafcode:mainfrom
frankosakwe:feature/file-validation-magic-bytes

Conversation

@frankosakwe

Copy link
Copy Markdown
  • Add file-type package dependency for magic bytes detection
  • Create CDN controller with upload endpoint
  • Implement file size validation (10MB images, 500MB videos)
  • Implement magic bytes validation to detect MIME type mismatches
  • Update media-processing.worker.ts with validation
  • Add comprehensive unit tests for size limits and MIME validation
  • Update file size limits to match specifications

Security improvements:

  • Reject files exceeding size limits with 413 error
  • Reject files with wrong magic bytes with 415 error
  • Prevent PHP scripts disguised as video files
  • Validate declared MIME type against actual file content

closes #850

- Add file-type package dependency for magic bytes detection
- Create CDN controller with upload endpoint
- Implement file size validation (10MB images, 500MB videos)
- Implement magic bytes validation to detect MIME type mismatches
- Update media-processing.worker.ts with validation
- Add comprehensive unit tests for size limits and MIME validation
- Update file size limits to match specifications

Security improvements:
- Reject files exceeding size limits with 413 error
- Reject files with wrong magic bytes with 415 error
- Prevent PHP scripts disguised as video files
- Validate declared MIME type against actual file content
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@frankosakwe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Add content-length validation and file type enforcement for media uploads

1 participant