Repository navigation
Conversation
…DING-001) ### Summary of Changes Resolves **FINDING-001** (High Severity) from the Starknet security audit: - **Zero-Address Validation in L2 Deposits:** - Added an explicit `assert(l2_recipient.is_non_zero(), Errors::INVALID_RECIPIENT);` check to `handle_deposit_common` in `TokenBridge`. - Guards all entry points (`handle_deposit`, `handle_token_deposit`, and `handle_deposit_with_message`) against directing newly minted tokens to the zero address (`0x0`). - Prevents irrevocable token loss and avoids potential dispatcher panics when invoking `on_receive` on zero addresses during message-bearing deposits. - **Test Coverage:** - Added `test_failed_handle_token_deposit_invalid_recipient` unit test in `TokenBridge::tests` verifying that deposits addressed to `0x0` revert with `'INVALID_RECIPIENT'`. ### Affected Files - `packages/bridge/src/token_bridge.cairo` ### Verification ```bash scarb --release build snforge test test_failed_handle_token_deposit_invalid_recipient snforge test
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 of Changes
Resolves FINDING-001 (High Severity) from the Starknet security audit:
assert(l2_recipient.is_non_zero(), Errors::INVALID_RECIPIENT);check tohandle_deposit_commoninTokenBridge.handle_deposit,handle_token_deposit, andhandle_deposit_with_message) against directing newly minted tokens to the zero address (0x0).on_receiveon zero addresses during message-bearing deposits.test_failed_handle_token_deposit_invalid_recipientunit test inTokenBridge::testsverifying that deposits addressed to0x0revert with'INVALID_RECIPIENT'.Affected Files
packages/bridge/src/token_bridge.cairoVerification