Commit 45e0adc
committed
Fixes #5233: Enhance MCP image handling with robust validation and security controls
- Enhanced accessMcpResourceTool.ts with comprehensive image validation
- Added magic byte checking for JPEG, PNG, GIF, WebP, and BMP formats
- Implemented security controls for max images per response and max image size
- Added VSCode settings for mcpMaxImagesPerResponse and mcpMaxImageSizeMB
- Added localization strings for new settings
- Created comprehensive test suite with 12 test cases covering:
- Image format validation (JPEG, PNG, GIF, WebP, BMP)
- Corrupted image detection
- Security limit enforcement
- Mixed content handling
- Error handling and edge cases
- Configuration management
- All tests passing with robust error handling and graceful degradation1 parent 3a8ba27 commit 45e0adc
File tree
4 files changed
+748
-10
lines changed- src
- __tests__
- core/tools
4 files changed
+748
-10
lines changed
0 commit comments