Fix: Ensure cross-network Web3 integrity, handle async wallet transitions, and enforce strict TypeScript boundaries - #4
Open
mozluk wants to merge 1 commit into
Open
Conversation
…ions, and enforce strict TypeScript boundaries ### Description This PR addresses cross-network configuration bugs, unhandled asynchronous wallet states, and loose TypeScript boundaries within the Etherlink `bridge` repository. **Vulnerabilities & Security Defects Remediated:** * **Cross-Network Web3 Integrity (`src/lib/beacon/beacon.ts`):** Beacon permissions and wallet connections previously used a hardcoded Ghostnet RPC regardless of the selected network. Both flows have been updated to dynamically use the selected network and the `NEXT_PUBLIC_NODE_URL` environment variable, with a documented Ghostnet fallback. * **Async Error Propagation (`src/contexts/TezosContext/TezosContext.tsx`, `src/components/Header/Header.tsx`):** Wallet connections, disconnections, and network transitions previously detached promises, leaving rejected operations unhandled. The context provider now explicitly awaits cleanup and transition operations, and the header component intercepts rejected wallet actions to present a user-visible notification via Mantine. * **Strict TypeScript Boundaries (`src/components/Faucet/Faucet.tsx`, `src/contexts/TezosContext/TezosContext.tsx`, `src/lib/types/type-aliases.ts`):** Removed explicit `any` types from caught exceptions and Michelson map-key arrays. Caught errors are now typed as `unknown` and explicitly narrowed (`error instanceof Error`) before use. Map keys now use `Array<unknown>`. Additionally, the Faucet component has been updated to report errors safely and reference the correct form field (address instead of email).
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.
Description
This PR addresses cross-network configuration bugs, unhandled asynchronous wallet states, and loose TypeScript boundaries within the Etherlink
bridgerepository.Vulnerabilities & Security Defects Remediated:
src/lib/beacon/beacon.ts): Beacon permissions and wallet connections previously used a hardcoded Ghostnet RPC regardless of the selected network. Both flows have been updated to dynamically use the selected network and theNEXT_PUBLIC_NODE_URLenvironment variable, with a documented Ghostnet fallback.src/contexts/TezosContext/TezosContext.tsx,src/components/Header/Header.tsx): Wallet connections, disconnections, and network transitions previously detached promises, leaving rejected operations unhandled. The context provider now explicitly awaits cleanup and transition operations, and the header component intercepts rejected wallet actions to present a user-visible notification via Mantine.src/components/Faucet/Faucet.tsx,src/contexts/TezosContext/TezosContext.tsx,src/lib/types/type-aliases.ts): Removed explicitanytypes from caught exceptions and Michelson map-key arrays. Caught errors are now typed asunknownand explicitly narrowed (error instanceof Error) before use. Map keys now useArray<unknown>. Additionally, the Faucet component has been updated to report errors safely and reference the correct form field (address instead of email).