-
Notifications
You must be signed in to change notification settings - Fork 68
fix: mcp SSE hardening #587
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
Conversation
vet Summary ReportThis report is generated by vet Policy Checks
Malicious Package AnalysisMalicious package analysis was performed using SafeDep Cloud API Malicious Package Analysis Report
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #587 +/- ##
========================================
+ Coverage 8.22% 8.31% +0.08%
========================================
Files 285 286 +1
Lines 47558 47641 +83
========================================
+ Hits 3914 3963 +49
- Misses 43371 43405 +34
Partials 273 273 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <[email protected]> Signed-off-by: Arunanshu Biswas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR hardens SSE (Server-Sent Events) security by implementing host and origin validation guards to prevent unauthorized cross-origin access and DNS rebinding attacks.
- Adds configurable host and origin guards as middleware to validate incoming requests
- Updates CORS header behavior to only set them when an Origin header is present
- Adds comprehensive test coverage for the new security guards and integration scenarios
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mcp/server/guard.go | Implements host and origin validation middleware |
| mcp/server/guard_test.go | Comprehensive tests for the new security guards |
| mcp/server/sse.go | Integrates security guards and updates CORS header logic |
| mcp/server/sse_test.go | Updates SSE handler tests for new origin-based CORS behavior |
| mcp/server/sse_integration_test.go | Adds integration tests for security guard validation |
| mcp/server/server.go | Adds configuration fields for allowed hosts and origins |
| cmd/server/mcp.go | Adds CLI flags for configuring allowed hosts and origins |
| docs/mcp.md | Documents the new security features and configuration options |
| go.mod | Removes unused dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Arunanshu Biswas <[email protected]>
…mcp-sse-hardening
No description provided.