feat: downstream x-request-id mirror + webhook HTTP fallback fix#1151
Open
gclapperton wants to merge 1 commit into
Open
feat: downstream x-request-id mirror + webhook HTTP fallback fix#1151gclapperton wants to merge 1 commit into
gclapperton wants to merge 1 commit into
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
487bfd4 to
e2425a4
Compare
e2425a4 to
7e93b9d
Compare
…quest-id - Pin snyk-request-id on HTTP fallback, WS, and streaming response paths so the broker's middleware-validated UUID is always authoritative - Mirror snyk-request-id onto x-request-id for outbound requests to customer systems (downstream tracing compatibility) - Make req.requestId the authoritative source in HybridClientRequestHandler constructor, replacing the previous ||= guard - Mask broker token in requestId synthesis debug log
cfe0fe5 to
dea3854
Compare
PR Reviewer Guide 🔍
|
gclapperton
commented
May 22, 2026
| ? req.url.replaceAll(brokerToken, maskToken(brokerToken)) | ||
| : req.url; | ||
| logger.debug( | ||
| { method: req.method, url: req.url }, |
Contributor
Author
There was a problem hiding this comment.
introduced in the last PR
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.
Context
This PR is part of a multi-PR effort to guarantee every request handled by broker carries a stable, traceable request ID end-to-end.
snyk-request-idon every inbound HTTP request [ACC-3093] #1127: HTTP inbound — every request hitting broker's Express server getssnyk-request-idassigned by middleware and echoed in the response.requestevent payload hassnyk-request-idbackfilled before it reachesBrokerWorkload.handler.This PR extends that guarantee outward to the customer system and close a gap in the webhook fallback path.
What problem does this solve?
Gap 1 — Downstream tracing. When broker fires an outbound HTTP request to a customer system (GitHub, GitLab, Jira, etc.), it sends
snyk-request-idbut never the more standardx-request-id. Tracing systems and proxies on the customer side that key offx-request-idcannot correlate the request back to anything in Snyk's traces.Gap 2 — Webhook HTTP fallback. The normal webhook flow (SCM → broker-client → WebSocket → broker-server → Snyk API) is fully covered by the other two PRs But when the WebSocket is unavailable, the broker-client falls back to a direct HTTP call to the Snyk API. In that fallback path, whatever
snyk-request-idthe Snyk API chose to echo could overwrite the UUID the broker had already assigned — breaking the invariant that the broker's ID is the correlation handle for the full round trip.