-
Notifications
You must be signed in to change notification settings - Fork 32
MCP-215 SSF #144
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
MCP-215 SSF #144
Conversation
41fdf10 to
c2af3ed
Compare
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 implements session-token binding to prevent session hijacking attacks in HTTP mode. The changes introduce a SessionTokenStore that maps MCP session IDs to authentication tokens, ensuring that a session can only be used with the token that created it. Additionally, the security filter is enhanced to prevent subdomain bypass attacks by validating exact host matches instead of prefix matching.
Key changes:
- New
SessionTokenStorecomponent with TTL-based expiration for secure session-token mappings - Modified
AuthenticationFilterto validate session-token bindings and reject hijacking attempts - Enhanced
McpSecurityFilterto prevent subdomain bypass attacks (e.g., localhost.evil.com) - Updated
RequestContextto store session IDs instead of tokens
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SessionTokenStore.java | New thread-safe store for session-token mappings with automatic TTL-based cleanup |
| SessionTokenStoreTest.java | Comprehensive test coverage for the new SessionTokenStore component |
| AuthenticationFilter.java | Modified to validate session-token bindings and prevent hijacking attempts |
| AuthenticationFilterTest.java | Added tests for session binding validation and hijacking prevention |
| RequestContext.java | Changed from storing tokens to storing session IDs |
| SonarQubeMcpServer.java | Updated to look up tokens from SessionTokenStore and handle session context |
| SonarQubeMcpServerGenericTest.java | Tests for server behavior with new session-based token lookup |
| McpSecurityFilter.java | Enhanced to prevent subdomain bypass attacks with exact host matching |
| McpSecurityFilterTest.java | Added tests for subdomain bypass attack prevention |
| http-authentication-architecture.md | Updated documentation to reflect new session-token binding architecture |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/org/sonarsource/sonarqube/mcp/authentication/SessionTokenStore.java
Show resolved
Hide resolved
c2af3ed to
1bf2ce2
Compare
1bf2ce2 to
5f64bc3
Compare
5f64bc3 to
3e101ea
Compare
damien-urruty-sonarsource
left a comment
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.
LGTM. The McpServer class is becoming huge, I think we should act on that. Lot of things going on there
src/main/java/org/sonarsource/sonarqube/mcp/authentication/SessionTokenStore.java
Outdated
Show resolved
Hide resolved
SonarQube reviewer guideImportant We are currently testing different models for AI Summary. Model A:Summary: Refactors HTTP authentication to prevent session hijacking using SessionTokenStore with session-to-token binding. Review Focus: The new Start review at: Model B:Summary: Refactor HTTP authentication to use session-token binding instead of ThreadLocal storage, improving security against session hijacking and simplifying async request handling. Review Focus:
Start review at:
|



No description provided.