feat: forward X-BitGo-OTP header from client requests to BitGo API#8493
Merged
sandra-wang-bitgo merged 1 commit intomasterfrom Apr 14, 2026
Merged
Conversation
e2d43b5 to
2a48eb4
Compare
The redirectRequest function was not forwarding any client headers to the BitGo API, which meant the X-BitGo-OTP header (used for 2FA) was being silently dropped. Add a FORWARDED_HEADERS whitelist and forward matching headers from incoming requests. Ticket: CS-7494
293d340 to
7b1ab98
Compare
kaustubhbitgo
approved these changes
Apr 14, 2026
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.
Description
This change adds support for forwarding the
X-BitGo-OTPheader from incoming client requests to the BitGo API. This enables clients to pass OTP (One-Time Password) credentials through the Express proxy to the backend BitGo service.The implementation introduces a configurable
FORWARDED_HEADERSlist that specifies which headers should be forwarded from incoming requests to the BitGo API. Currently, onlyx-bitgo-otpis included, but the design allows for easy addition of other headers in the future.Changes Made:
FORWARDED_HEADERSconstant to define which headers should be forwardedredirectRequest()function to iterate through forwarded headers and set them on outgoing requestsType of change
How Has This Been Tested?
Added two new unit tests in
modules/express/test/unit/clientRoutes/index.ts:should forward X-BitGo-OTP header when present- Verifies the header is correctly forwarded to the BitGo API when included in the incoming requestshould not forward X-BitGo-OTP header when not present- Verifies the code handles the absence of the header gracefullyBoth tests verify the behavior through stubbed responses and assertion on the
set()method calls.Checklist:
TICKET: CUS-80