Skip to content

Security: fix session leaks, OAuth redirect validation, host header injection#29

Open
nicdavidson wants to merge 4 commits intodevelopfrom
2026-04-security-scan
Open

Security: fix session leaks, OAuth redirect validation, host header injection#29
nicdavidson wants to merge 4 commits intodevelopfrom
2026-04-security-scan

Conversation

@nicdavidson
Copy link
Copy Markdown
Contributor

Summary

Daemon (server.ts)

  • Remove session ID arrays from /health and /ping responses (return count only)
  • Add internal API key check to /mcp/cache/clear endpoint

PHP middleware (McpStreamMiddleware.php)

  • CORS kept permissive (*) — MCP clients are inherently external

OAuth controller (McpOAuthController.php)

  • Validate redirect_uri against client's registered redirect URIs
  • Replace X-Forwarded-Host header trust with APP_URL config to prevent host header injection

Test plan

  • TypeScript compiles cleanly (tsc --noEmit)
  • PHP syntax verified (php -l)
  • Daemon health endpoint returns active_sessions count (not session IDs)
  • All API endpoints functional through PHP middleware

oleksandrkits and others added 4 commits March 24, 2026 16:14
…jection

Daemon (server.ts):
- Replace wildcard CORS with configurable MCP_CORS_ORIGIN (default localhost:8080)
- Remove session ID arrays from /health and /ping responses (use count only)
- Add internal API key check to /mcp/cache/clear endpoint

PHP middleware (McpStreamMiddleware.php):
- Replace wildcard Access-Control-Allow-Origin with app.url config value

OAuth controller (McpOAuthController.php):
- Validate redirect_uri against client's registered redirect_uris
- Replace X-Forwarded-Host trust with APP_URL config to prevent host header injection
MCP clients (Claude Desktop, Cursor, etc.) connect from arbitrary
origins. Endpoints are already protected by DreamFactory session tokens.
Restrictive CORS would break all external MCP client connections.
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.

2 participants