Skip to content

Security: Enforce positive Web3 transaction amounts, validate ISO 7064 IBAN checksums, and resolve async component races - #20

Open
mertcano wants to merge 1 commit into
krakenfx:masterfrom
mertcano:mertcano-patch-1
Open

mertcano wants to merge 1 commit into
krakenfx:masterfrom
mertcano:mertcano-patch-1

Conversation

@mertcano

Copy link
Copy Markdown

Why

Arbitrary inputs were previously passed directly into web3.toWei, allowing malformed or non-positive values to trigger errors or progress into the transaction flow. Ethereum IBAN validation was incomplete and only verified the XE...ETHKRAKEN prefix without validating the underlying checksum, risking fund loss on mistyped addresses. The Balance component relied on an invalid React lifecycle callback (componentDidReceiveProps), which caused asynchronous race conditions and prevented balances from updating correctly when addresses changed.

How

Implemented a strict regex and numeric bounds check inside EnterAmount.onSubmit to require a positive decimal amount before invoking web3.toWei. Replaced the weak IBAN check in sendIbanTransaction.js with a robust validator that normalizes the input, enforces the Kraken Ethereum IBAN grammar, and calculates the ISO 7064 modulo-97 checksum (remainder === 1). Refactored Balance.jsx to use standard lifecycle methods (componentDidMount, componentWillReceiveProps, componentWillUnmount), tracking request generations and ignoring stale asynchronous callbacks.

Security/Robustness changes

Hardens the transaction submission boundaries by guaranteeing that only mathematically sound, positive amounts reach the smart contract execution layer. Protects users from irreversible cross-chain routing failures by mathematically validating the destination address integrity.

Testing

Verified that swoop/src/sendIbanTransaction.js passes standard node --check validation. (Note: The complete Swoop test suite execution was blocked because babel-node was absent in the available CI/build environment).

…4 IBAN checksums, and resolve async component races

Why

Arbitrary inputs were previously passed directly into web3.toWei, allowing malformed or non-positive values to trigger errors or progress into the transaction flow.  Ethereum IBAN validation was incomplete and only verified the XE...ETHKRAKEN prefix without validating the underlying checksum, risking fund loss on mistyped addresses.  The Balance component relied on an invalid React lifecycle callback (componentDidReceiveProps), which caused asynchronous race conditions and prevented balances from updating correctly when addresses changed.  

How

Implemented a strict regex and numeric bounds check inside EnterAmount.onSubmit to require a positive decimal amount before invoking web3.toWei.  Replaced the weak IBAN check in sendIbanTransaction.js with a robust validator that normalizes the input, enforces the Kraken Ethereum IBAN grammar, and calculates the ISO 7064 modulo-97 checksum (remainder === 1).  Refactored Balance.jsx to use standard lifecycle methods (componentDidMount, componentWillReceiveProps, componentWillUnmount), tracking request generations and ignoring stale asynchronous callbacks.  

Security/Robustness changes

Hardens the transaction submission boundaries by guaranteeing that only mathematically sound, positive amounts reach the smart contract execution layer.  Protects users from irreversible cross-chain routing failures by mathematically validating the destination address integrity.  

Testing

Verified that swoop/src/sendIbanTransaction.js passes standard node --check validation.  (Note: The complete Swoop test suite execution was blocked because babel-node was absent in the available CI/build environment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant