Skip to content
This repository was archived by the owner on Nov 5, 2026. It is now read-only.

Fix: Remove embedded private key and enforce strict wallet metadata validation - #62

Open
magqqgq wants to merge 1 commit into
linera-io:mainfrom
magqqgq:magqqgq-patch-1
Open

magqqgq wants to merge 1 commit into
linera-io:mainfrom
magqqgq:magqqgq-patch-1

Conversation

@magqqgq

@magqqgq magqqgq commented Aug 23, 2026

Copy link
Copy Markdown

Description

This PR addresses critical secrets management and data handling vulnerabilities within the linera-web extension. Previously, the extension background script hardcoded a private key literal, silently ignored uploaded wallet files, and retained unvalidated JSON structures in memory. This update removes all embedded key material, strictly validates the shape of imported wallet metadata, and ensures only safe, non-sensitive chain identifiers are retained.

Vulnerabilities & Security Defects Remediated:

  • Embedded Private Key Removal (linera-web/extension/src/wallet/index.ts): Removed the hardcoded PrivateKey literal from the Server::setWallet flow. The browser client is now safely disposed of and fails closed if a supported initialization path is unavailable, rather than defaulting to an insecure embedded key[cite: 2].
  • Strict Metadata Validation & Redaction (linera-web/extension/src/wallet/index.ts): Implemented parseWalletMetadata to strictly validate uploaded JSON. The extension now discards the raw file contents and only retains the default chain identifier in memory[cite: 2].
  • Explicit Error Handling (linera-web/extension/src/sidebar/index.ts, linera-web/extension/src/wallet/index.ts): Client query failures and malformed wallet uploads are now caught and returned explicitly as errors through the message bridge, preventing uncaught promise rejections and silent UI failures[cite: 2].

Validation:

  • Source-level integrity confirmed for key removal and JSON validation logic[cite: 2].
  • The wallet selection sidebar handles malformed JSON securely without crashing the background process[cite: 2].

…alidation


### Description
This PR addresses critical secrets management and data handling vulnerabilities within the `linera-web` extension. Previously, the extension background script hardcoded a private key literal, silently ignored uploaded wallet files, and retained unvalidated JSON structures in memory. This update removes all embedded key material, strictly validates the shape of imported wallet metadata, and ensures only safe, non-sensitive chain identifiers are retained.

**Vulnerabilities & Security Defects Remediated:**
* **Embedded Private Key Removal (`linera-web/extension/src/wallet/index.ts`):** Removed the hardcoded `PrivateKey` literal from the `Server::setWallet` flow. The browser client is now safely disposed of and fails closed if a supported initialization path is unavailable, rather than defaulting to an insecure embedded key[cite: 2].
* **Strict Metadata Validation & Redaction (`linera-web/extension/src/wallet/index.ts`):** Implemented `parseWalletMetadata` to strictly validate uploaded JSON. The extension now discards the raw file contents and only retains the `default` chain identifier in memory[cite: 2].
* **Explicit Error Handling (`linera-web/extension/src/sidebar/index.ts`, `linera-web/extension/src/wallet/index.ts`):** Client query failures and malformed wallet uploads are now caught and returned explicitly as errors through the message bridge, preventing uncaught promise rejections and silent UI failures[cite: 2].

**Validation:**
* Source-level integrity confirmed for key removal and JSON validation logic[cite: 2].
* The wallet selection sidebar handles malformed JSON securely without crashing the background process[cite: 2].
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant