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

🛡️ fix: Enhance File Upload Security & Error Handling #4705

Merged
merged 17 commits into from
Nov 12, 2024

Conversation

danny-avila
Copy link
Owner

@danny-avila danny-avila commented Nov 12, 2024

Summary

I implemented comprehensive improvements to file handling and security across upload routes, focusing on avatar uploads, conversation parsing, and error handling.

  • Added filename sanitization utility and integrated it into multer storage configuration
  • Implemented automatic cleanup of temporary files after processing in image and avatar routes
  • Refactored avatar upload handling to use fs.readFile and enhanced file validation checks
  • Added proper error handling for conversation parsing in buildEndpointOption middleware
  • Enhanced error logging and response handling in checkBan middleware
  • Fixed access control for prompt group deletion by validating author permissions
  • Refactored avatar upload routes for agents and assistants to use consistent patterns
  • Added proper file size validation and mime type checks for avatar uploads
  • Fixed cleanup flag handling to ensure proper temporary file deletion
  • Improved error messages and logging across file upload routes

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective

@danny-avila danny-avila linked an issue Nov 12, 2024 that may be closed by this pull request
1 task
@danny-avila danny-avila merged commit d012da0 into main Nov 12, 2024
4 checks passed
@danny-avila danny-avila deleted the fix/file-uploads branch November 12, 2024 21:41
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.

[Bug]: Markdown equations rendered scrollable
1 participant