Repository navigation
fix(express): handle circular request bodies in error redaction - #10032
Merged
MohammedRyaan786 merged 1 commit intoOct 23, 2026
Merged
Conversation
Contributor
MohammedRyaan786
force-pushed
the
COINS-1940-fix-express-redaction-recursion
branch
from
October 22, 2026 17:18
445f797 to
4817b69
Compare
Contributor
Author
|
@claude please review the PR for correctness and provide a verdict |
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Contributor
|
@claude review thoroughly and give approval rating |
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
MohammedRyaan786
force-pushed
the
COINS-1940-fix-express-redaction-recursion
branch
from
October 23, 2026 10:39
4817b69 to
ddb9fad
Compare
Ticket: COINS-1940 Co-authored-by: Ralph CLI <ralph-cli@bitgo.com> Ralph: 18.12.3-bitgo.3 openrouter/z-ai/glm-5.3-flash@smol openrouter/google/gemini-3.8-flash@commit openrouter/z-ai/glm-5.3@task+plan openrouter/openai/gpt-5.6-luna@advisor+slow openrouter/openai/gpt-5.6-luna-pro@default
MohammedRyaan786
force-pushed
the
COINS-1940-fix-express-redaction-recursion
branch
from
October 23, 2026 10:42
ddb9fad to
9621bbd
Compare
Contributor
|
@claude review |
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
pranishnepal
approved these changes
Oct 23, 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
When a send route fails partway through, BitGo Express hangs and never responds. The client eventually gets a
503 Response timeout.Root cause
createSendParams/createTSSSendParamspassedreq.bodyitself to the SDK.Object.assign(params, { wallet: this }), soreq.bodyended up holding a self-referencingWallet.handleRequestHandlerErrorwalkedreq.bodyto collect secrets for redaction.collectSensitiveRequestValueshad no cycle check, so it threwRangeError: Maximum call stack size exceeded.This reproduces on Express 17.x with a TZEC multi-recipient
sendmany. Single-recipient sends succeed, so they never reach the error handler.Changes (
modules/express/src/clientRoutes.ts)createSendParamsandcreateTSSSendParamsnow pass the SDK a shallow copy ofreq.body(cloneRequestBody), so the SDK's changes to its params don't end up onreq.body. TheexternalSignerUrlbranches already spread the body. Every handler finishes writing toreq.body(reqId,eip1559, …) before the copy is made, and none reads it after the SDK call.collectSensitiveRequestValuestracks objects it has already visited in aWeakSet, so circular values can't recurse forever.redactSensitiveValuestracks the objects on the current path. A real cycle comes out as'[Circular]'; an object referenced from two places is still redacted in both. This covers circularerr.resultpayloads.This fixes the Express hang. Failed sends now return their real error, properly redacted. It does not fix the underlying ZEC multi-recipient
sendmanyerror, which is still tracked under COINS-1940 and can be diagnosed once Express returns it.Issue Number
COINS-1940
Type of change
How Has This Been Tested?
sendmanythrough Express hung withRangeError: Maximum call stack size exceededincollectSensitiveRequestValues, then503 Response timeout.test/unit/clientRoutes/index.ts, "should handle circular request bodies while redacting errors": runspromiseWrapperwith a circular request body and a circularerr.result. It checks for a 500 response, the messagefailed with [REDACTED],result.secretredacted, andresult.selfset to'[Circular]'.test/unit/typedRoutes/sendmany.ts, "should redact secrets when sendMany mutates the cloned params and then fails": goes through the real/sendmanyroute. A mockedwallet.sendManyattaches a self-referencingwalletto its params, deleteswalletPassphrase, and throws an error that contains the passphrase. The test checks for a 400 withfailed to sign with [REDACTED], no passphrase in the response or the logs, and that the SDK received a copy rather than the request body. It fails whencreateSendParamsreturnsreq.bodydirectly.npx mocha test/unit/typedRoutes/sendmany.ts(sendmany cases) locally. CI is green on Node 22/24/26 and in the browser test.Checklist:
🤖 Generated with Claude Code
https://claude.ai/code/session_017jhLrU9uZW7fCwMPnqSQ6b