fix(mcp): restore real keyless identity and recovery correlation - #336
Merged
Conversation
hmishra2250
marked this pull request as ready for review
July 26, 2026 19:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
X-Forwarded-Forvalue instead of replacing it with the Traefik pod IPrequest_idvalues and correlate execution-time recovery responses with[MCP_ACTION]error eventsWhy
Hosted anonymous traffic is currently bucketed by the Traefik pod address because nginx overwrites
X-Forwarded-Forwith$remote_addr. Core uses the forwarded value for keyless quotas, credits, team identity, audit data, and Spur checks. This change restores the real edge-sanitized client identity without trusting client-provided forwarding chains.The Stage-1 recovery contract also lost its server-generated
request_id. This PR restores that correlation boundary without accepting JSON-RPC IDs or request headers as recovery IDs.Scope / safety
externalTrafficPolicy: Local, MCP Services areClusterIP, and noforwardedHeadersoverride is configuredValidation
npm test— 46/46 passingnpm run lintdocker build -f Dockerfile.service -t firecrawl-mcp:keyless-identity-recovery-id .nginx -tinside the built service imagev3.5.0-> nginx -> MCP -> fake Core wire test:request_id[MCP_ACTION]errorrequest_idNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Restore real hosted keyless identity and server-generated recovery correlation. This forwards the edge-sanitized client IP and adds reliable
request_idvalues that match[MCP_ACTION]logs, fixing per-IP quotas and recovery flows.X-Forwarded-Forfrom$http_x_forwarded_forand reject multi-hop or malformed values.request_idon the server, include it in recovery payloads, and use the same ID in[MCP_ACTION]logs; ignore client JSON-RPC IDs andx-request-id.requestIdthrough tool execution and keyless recoveries (eligibility, quota, ZDR) and preserve the managed OAuth API key in the invocation context.Written for commit b8dfb26. Summary will update on new commits.