You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-03-31] [$250] [VBBA] connectBankAccountWithPlaid can send bankAccountID as NaN after verify-account resume flow #85747
Please re-state the problem that we are trying to solve in this issue.
In the USD reimbursement bank account flow, CONNECT_BANK_ACCOUNT_WITH_PLAID can be sent with bankAccountID=NaN. This happens when a user with an unvalidated account goes through the verify-account redirect, then resumes the Plaid connect flow. The NaN value bypasses frontend logic that relies on bankAccountID === 0 (e.g., Chase manual fallback checks).
When achData.bankAccountID is undefined (which it is for new account setups before the backend allocates one, and specifically after the verify-account resume flow where removeExistingBankAccountDetails() is not called), Number(undefined) produces NaN.
This NaN is passed directly to connectBankAccountWithPlaid() at BankAccounts.ts:257-271, which forwards it into the API request params with zero validation.
Why the resume flow specifically triggers this: In VerifiedBankAccountFlowEntryPoint, the happy path (handleConnectPlaid) calls removeExistingBankAccountDetails() which sets bankAccountID: 0 via updateReimbursementAccount. But the resume-after-validation path (the useEffect that fires when isAccountValidated becomes true) skips removeExistingBankAccountDetails(), leaving bankAccountID as undefined.
Two additional components have the same vulnerability:
Add a defensive guard in connectBankAccountWithPlaid (BankAccounts.ts) to normalize non-finite bankAccountID values to CONST.DEFAULT_NUMBER_ID before building the request params. This provides a safety net at the API boundary regardless of which component calls it.
Fix the resume flow in VerifiedBankAccountFlowEntryPoint to call removeExistingBankAccountDetails() (or at minimum initialize bankAccountID: 0) when resuming after validation, matching the happy path behavior.
What alternative solutions did you explore? (Optional)
Guard only at the API layer (in connectBankAccountWithPlaid): Simpler but doesn't fix the same pattern in PersonalInfo and CompleteVerification which call different API functions.
Guard only at the component level: Fixes the immediate symptom but leaves the API function vulnerable to future callers passing NaN.
Applying both layers (component + API) is the most robust approach and matches the defensive pattern already used in BankAccountValidationForm.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-][VBBA] connectBankAccountWithPlaid can send bankAccountID as NaN after verify-account resume flow[/-][+][$250] [VBBA] connectBankAccountWithPlaid can send bankAccountID as NaN after verify-account resume flow[/+]on Mar 19, 2026
Understood — I've removed the External label. My earlier comment was an analysis posted in response to a /analyze-issue request, not an external proposal. The analysis and root cause findings are still available above for reference as you work on the fix.
Activity
c3024 commentedon Mar 19, 2026
This is not open for proposals. I am working on this issue.
MelvinBot commentedon Mar 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the USD reimbursement bank account flow,
CONNECT_BANK_ACCOUNT_WITH_PLAIDcan be sent withbankAccountID=NaN. This happens when a user with an unvalidated account goes through the verify-account redirect, then resumes the Plaid connect flow. TheNaNvalue bypasses frontend logic that relies onbankAccountID === 0(e.g., Chase manual fallback checks).What is the root cause of that problem?
BankInfo.tsxat line 54 computes:When
achData.bankAccountIDisundefined(which it is for new account setups before the backend allocates one, and specifically after the verify-account resume flow whereremoveExistingBankAccountDetails()is not called),Number(undefined)producesNaN.This
NaNis passed directly toconnectBankAccountWithPlaid()at BankAccounts.ts:257-271, which forwards it into the API request params with zero validation.Why the resume flow specifically triggers this: In
VerifiedBankAccountFlowEntryPoint, the happy path (handleConnectPlaid) callsremoveExistingBankAccountDetails()which setsbankAccountID: 0viaupdateReimbursementAccount. But the resume-after-validation path (theuseEffectthat fires whenisAccountValidatedbecomes true) skipsremoveExistingBankAccountDetails(), leavingbankAccountIDasundefined.Two additional components have the same vulnerability:
src/pages/ReimbursementAccount/USD/BankInfo/BankInfo.tsxsrc/pages/ReimbursementAccount/USD/Requestor/PersonalInfo/PersonalInfo.tsxsrc/pages/ReimbursementAccount/USD/CompleteVerification/CompleteVerification.tsxThree sibling components already use the correct pattern:
src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsxsrc/pages/ReimbursementAccount/USD/BeneficialOwnerInfo/BeneficialOwnersStep.tsxsrc/pages/ReimbursementAccount/USD/ConnectBankAccount/components/BankAccountValidationForm.tsxWhat changes do you think we should make in order to solve the problem?
Add the
?? CONST.DEFAULT_NUMBER_IDfallback to all three vulnerable components to match the established pattern:BankInfo.tsx:54→Number(reimbursementAccount?.achData?.bankAccountID ?? CONST.DEFAULT_NUMBER_ID)PersonalInfo.tsx:40→ same patternCompleteVerification.tsx:35→ same patternAdd a defensive guard in
connectBankAccountWithPlaid(BankAccounts.ts) to normalize non-finitebankAccountIDvalues toCONST.DEFAULT_NUMBER_IDbefore building the request params. This provides a safety net at the API boundary regardless of which component calls it.Fix the resume flow in
VerifiedBankAccountFlowEntryPointto callremoveExistingBankAccountDetails()(or at minimum initializebankAccountID: 0) when resuming after validation, matching the happy path behavior.What alternative solutions did you explore? (Optional)
connectBankAccountWithPlaid): Simpler but doesn't fix the same pattern inPersonalInfoandCompleteVerificationwhich call different API functions.NaN.BankAccountValidationForm.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Mar 19, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 (
External)[-][VBBA] connectBankAccountWithPlaid can send bankAccountID as NaN after verify-account resume flow[/-][+][$250] [VBBA] connectBankAccountWithPlaid can send bankAccountID as NaN after verify-account resume flow[/+]melvin-bot commentedon Mar 19, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022034553283540872833
c3024 commentedon Mar 19, 2026
@MelvinBot this is not open for proposals by external contributors.
MelvinBot commentedon Mar 19, 2026
Understood — I've removed the
Externallabel. My earlier comment was an analysis posted in response to a/analyze-issuerequest, not an external proposal. The analysis and root cause findings are still available above for reference as you work on the fix.23 remaining items
melvin-bot commentedon Mar 31, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
ikevin127 commentedon Mar 31, 2026
@mallenexpensify 🟢 BZ Checklist completed - awaiting payment summary.
mallenexpensify commentedon Apr 2, 2026
Payment Summary
Contributor+: @ikevin127 due $250 via NewDot
^ Test case created
Thx!
garrettmknight commentedon Apr 2, 2026
$250 approved for @ikevin127