Conversation
Ten debug pages inline the numeric input rule as `!isNaN(parseInt(v))`. parseInt parses a leading numeric prefix and ignores the rest, so "12abc" passed validation; a downstream parseFloat would then move a different value than the user typed. Match the whole string against an (optionally signed) integer/decimal number instead. This mirrors the fix to the shared isNumber rule in helpers/validation.ts (circlefin#470); these pages carry divergent inline copies that bypass it.
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
Ten debug pages inline their numeric input rule as:
parseIntparses a leading numeric prefix and ignores the rest, soparseInt("12abc") === 12— meaning"12abc"(and"1.5x","0x10", etc.) passes the rule. A field that passes is then read withparseFloat, which coerces the malformed value to a different number than the user typed.Fix
Match the whole string against an optionally-signed integer/decimal number instead:
One-line change per page; signed and decimal values keep working, empty stays valid, and trailing garbage / hex / scientific-notation strings are now rejected.
Pages fixed:
businessAccount/bankAccounts/{create,fetch},businessAccount/transfers/fetch,paymentIntents/fetch,payments/fetch,payouts/fetch,settlements/fetch,stablefx/quote,trades/flow/index,trades/quote.Notes
These are divergent inline copies of the shared
isNumberrule inhelpers/validation.ts(which other debug pages import, and which #470 hardens with the same regex). This applies the same correctness fix to the pages that bypass the shared helper.eslintis clean on the changed files.