Repository navigation
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
Conversation
…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).
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.
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).