chore(frontend): triage dependencies and reduce measured wallet bundle cost safely #50

Open
opened 2026-10-14 03:12:05 +00:00 by PlasticDigits · 0 comments
Owner

Scope and source

Priority: P1. Gap coverage: GAP-023, GAP-047. Derived from GAP_1791945837.md, reviewed code commit f8dbe93df953a78b17cb3304b717dcf84c4cd517. Current e476a68da09645c2308cbf47b90211fcaffcb7af adds only the report, so implementation findings remain applicable. Report evidence is local reproduction/source inspection unless explicitly proposed; no production exploit or current live-readiness claim.

Coverage and sequencing: gap backlog tracker. Workstream 14. Dependencies: 08, 11, 13.

Current codebase

Audit snapshot reported 70 affected npm entries (11 high), not 70 proven exploits; several fixes require majors and Rust advisories were not audited. Renovate is disabled. Build processed 8,085 modules and ~1,013 kB entry; Tiptap appears unused, legacy WC overlaps modern EVM dependencies. These build sizes are not measured page-load/Core Web Vitals.

Why this implementation is needed

Runtime/build advisory risk needs ongoing evidence-based triage, and eager wallet loading increases mobile participation cost. Connector stability and pairing behavior must survive any upgrade or split.

Relevant files

Re-run npm/Rust advisory inventories and map installed version/path to runtime/build reachability and fixes; prioritize genuinely reachable severe findings. Remove confirmed unused packages before considering compatible targeted updates; track time-bounded reviewed exceptions and automate scans/controlled updates. Measure import graph, mobile load and user interaction before budgets. Lazy-load route/modal/connector/editor code where safe, preserving pairing hook before createRoot and pinned patch application. Review any necessary wallet-stack upgrade against DEX/Bridge ports; no greenfield replacement or force audit fix.

Constraints and guardrails

Preserve standalone offchain advisory voting, no new smart contracts or archive-node dependency, BSC as a core electorate, raw 18-decimal integer balances and separate Terra/BSC address identities. Keep Legal fail-closed transactional UI and the proven DEX Terra/Bridge EVM connectors; no browser BSC balance RPC, seed/key prompt or embedded admin/model credential. API must retain a restricted role separate from the ledger writer. Freeze at actual opening, never at draft creation or a client-supplied height. Agents own design, implementation, review and evidence under repository guidance; do not shift approvals/tests to the human or invent PASS evidence.

Acceptance criteria

Each advisory has version/path/reachability/fix or bounded exception and owner. Lockfiles stay reproducible and unused dependency removal is evidenced. Pairing patch still applies after npm ci; supported Terra/EVM injected/WC signing survives. Measured bundle/load budget improves or has documented reason, and required wallet code loads under production CSP.

Test plan: supported paths, failure paths and concurrency

Clean install/build under pinned Node and Rust, advisory scans with reachable/nonreachable examples, expired exception gate and lockfile integrity. Cold/warm route load, slow mobile network, connect/cancel/reconnect/QR/deeplink and offchain signing for both chains. Assert early pairing hook and patched marker, Legal navigation, lazy chunk failures/retry and CSP request coverage. Compare before/after compressed chunks and runtime interaction metrics.

Test plan: attack, hack and abuse vectors

Advisory-specific malicious input only for reachable code in isolated fixtures; supply-chain install/script/cache tampering and dependency downgrade; WC relay/URI unsafe handling, delayed-hook race and poisoned lazy chunks. Do not use audit count alone as exploit evidence or remove required legacy connector behavior without proof.

Verification and completion criteria

Attach dated advisory triage matrix, reproducible installs, before/after measurements and connector/CSP regression results. Severe reachable findings are fixed or covered by explicit expiring mitigation; live real-wallet QA remains separate from simulated tests.

Record commit and pinned toolchain, commands/results and sanitized artifacts. Relevant Rust changes require cargo test --workspace --lib plus isolated Postgres integration (explicit guarded LEDGER_TEST_DATABASE_URL); frontend changes require npm test and production build plus relevant browser cases. Run secret scanning for new fixtures/config. Exercise fresh/upgrade migrations when schema/grants change; report skipped/live-only checks explicitly.

<!-- voting-gap-1791945837:14 --> ## Scope and source **Priority:** P1. **Gap coverage:** GAP-023, GAP-047. Derived from [GAP_1791945837.md](https://git.cl8y.com/code/voting/src/branch/main/gaps/GAP_1791945837.md), reviewed code commit `f8dbe93df953a78b17cb3304b717dcf84c4cd517`. Current `e476a68da09645c2308cbf47b90211fcaffcb7af` adds only the report, so implementation findings remain applicable. Report evidence is local reproduction/source inspection unless explicitly proposed; no production exploit or current live-readiness claim. Coverage and sequencing: [gap backlog tracker](https://git.cl8y.com/code/voting/issues/35). Workstream **14**. Dependencies: [08](https://git.cl8y.com/code/voting/issues/43), [11](https://git.cl8y.com/code/voting/issues/46), [13](https://git.cl8y.com/code/voting/issues/49). ## Current codebase Audit snapshot reported 70 affected npm entries (11 high), not 70 proven exploits; several fixes require majors and Rust advisories were not audited. Renovate is disabled. Build processed 8,085 modules and ~1,013 kB entry; Tiptap appears unused, legacy WC overlaps modern EVM dependencies. These build sizes are not measured page-load/Core Web Vitals. ## Why this implementation is needed Runtime/build advisory risk needs ongoing evidence-based triage, and eager wallet loading increases mobile participation cost. Connector stability and pairing behavior must survive any upgrade or split. ## Relevant files - [`frontend/package.json`](https://git.cl8y.com/code/voting/src/branch/main/frontend/package.json) - [`frontend/package-lock.json`](https://git.cl8y.com/code/voting/src/branch/main/frontend/package-lock.json) - [`frontend/patches/@goblinhunt+cosmes+0.0.71-ghunt.22.patch`](https://git.cl8y.com/code/voting/src/branch/main/frontend/patches/@goblinhunt+cosmes+0.0.71-ghunt.22.patch) - [`frontend/src/main.tsx`](https://git.cl8y.com/code/voting/src/branch/main/frontend/src/main.tsx) - [`frontend/src/lib/wagmi.ts`](https://git.cl8y.com/code/voting/src/branch/main/frontend/src/lib/wagmi.ts) - [`frontend/src/services/terraclassic/walletConnectPairingHook.ts`](https://git.cl8y.com/code/voting/src/branch/main/frontend/src/services/terraclassic/walletConnectPairingHook.ts) - [`frontend/vite.config.ts`](https://git.cl8y.com/code/voting/src/branch/main/frontend/vite.config.ts) - [`Cargo.toml`](https://git.cl8y.com/code/voting/src/branch/main/Cargo.toml) - [`Cargo.lock`](https://git.cl8y.com/code/voting/src/branch/main/Cargo.lock) - [`renovate.json`](https://git.cl8y.com/code/voting/src/branch/main/renovate.json) - [`.gitlab-ci.yml`](https://git.cl8y.com/code/voting/src/branch/main/.gitlab-ci.yml) - [`.woodpecker.yaml`](https://git.cl8y.com/code/voting/src/branch/main/.woodpecker.yaml) ## Recommended solution Re-run npm/Rust advisory inventories and map installed version/path to runtime/build reachability and fixes; prioritize genuinely reachable severe findings. Remove confirmed unused packages before considering compatible targeted updates; track time-bounded reviewed exceptions and automate scans/controlled updates. Measure import graph, mobile load and user interaction before budgets. Lazy-load route/modal/connector/editor code where safe, preserving pairing hook before createRoot and pinned patch application. Review any necessary wallet-stack upgrade against DEX/Bridge ports; no greenfield replacement or force audit fix. ## Constraints and guardrails Preserve standalone offchain advisory voting, no new smart contracts or archive-node dependency, BSC as a core electorate, raw 18-decimal integer balances and separate Terra/BSC address identities. Keep Legal fail-closed transactional UI and the proven DEX Terra/Bridge EVM connectors; no browser BSC balance RPC, seed/key prompt or embedded admin/model credential. API must retain a restricted role separate from the ledger writer. Freeze at actual opening, never at draft creation or a client-supplied height. Agents own design, implementation, review and evidence under repository guidance; do not shift approvals/tests to the human or invent PASS evidence. ## Acceptance criteria Each advisory has version/path/reachability/fix or bounded exception and owner. Lockfiles stay reproducible and unused dependency removal is evidenced. Pairing patch still applies after npm ci; supported Terra/EVM injected/WC signing survives. Measured bundle/load budget improves or has documented reason, and required wallet code loads under production CSP. ## Test plan: supported paths, failure paths and concurrency Clean install/build under pinned Node and Rust, advisory scans with reachable/nonreachable examples, expired exception gate and lockfile integrity. Cold/warm route load, slow mobile network, connect/cancel/reconnect/QR/deeplink and offchain signing for both chains. Assert early pairing hook and patched marker, Legal navigation, lazy chunk failures/retry and CSP request coverage. Compare before/after compressed chunks and runtime interaction metrics. ## Test plan: attack, hack and abuse vectors Advisory-specific malicious input only for reachable code in isolated fixtures; supply-chain install/script/cache tampering and dependency downgrade; WC relay/URI unsafe handling, delayed-hook race and poisoned lazy chunks. Do not use audit count alone as exploit evidence or remove required legacy connector behavior without proof. ## Verification and completion criteria Attach dated advisory triage matrix, reproducible installs, before/after measurements and connector/CSP regression results. Severe reachable findings are fixed or covered by explicit expiring mitigation; live real-wallet QA remains separate from simulated tests. Record commit and pinned toolchain, commands/results and sanitized artifacts. Relevant Rust changes require `cargo test --workspace --lib` plus isolated Postgres integration (explicit guarded LEDGER_TEST_DATABASE_URL); frontend changes require `npm test` and production build plus relevant browser cases. Run secret scanning for new fixtures/config. Exercise fresh/upgrade migrations when schema/grants change; report skipped/live-only checks explicitly.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/voting#50
No description provided.