Skip to content

fix: sanitize public address validation responses#18

Merged
NateIsern merged 1 commit into
mainfrom
codex/fix-public-address-validation-vulnerability
Jun 25, 2026
Merged

fix: sanitize public address validation responses#18
NateIsern merged 1 commit into
mainfrom
codex/fix-public-address-validation-vulnerability

Conversation

@NateIsern

Copy link
Copy Markdown
Member

Motivation

  • Prevent public API leakage of wallet-local metadata returned by the daemon's validateaddress RPC (fields such as ismine, iswatchonly, pubkey, labels, account, etc.).
  • Keep the /api/validate-address endpoint safe for unauthenticated callers by exposing only non-sensitive validation information.

Description

  • Add sanitizeAddressValidation to server/lib/http.ts which normalizes RPC responses and returns only isvalid and a validated address when present. (new public type PublicAddressValidation).
  • Make BlockCache.validateAddress return the sanitized shape instead of the raw RPC result by calling sanitizeAddressValidation in server/lib/cache.ts.
  • Harden the public route by parsing/validating the address query via parseAddress before invoking RPC-backed validation in server/index.ts.
  • Update the client types and UI to reflect the public, wallet-metadata-free response: adjust NodeAddressValidation in src/hooks/use-validate-address.ts and remove rendering of ismine, iswatchonly, and isscript in src/components/address-validator-content.tsx.
  • Add unit tests in server/lib/http.test.ts that assert sensitive fields are stripped and malformed RPC responses normalize to a safe invalid result.

Testing

  • Ran unit tests with npm test; all tests passed (4 files passed, 44 tests passed).
  • Ran static type checks with npm run typecheck; the TypeScript build passed.
  • Added and executed unit coverage for sanitizeAddressValidation in server/lib/http.test.ts, which succeeded as part of the test run.

Codex Task

@NateIsern
NateIsern merged commit f794f62 into main Jun 25, 2026
1 check passed
@NateIsern
NateIsern deleted the codex/fix-public-address-validation-vulnerability branch June 25, 2026 19:45
NateIsern added a commit that referenced this pull request Jun 25, 2026
Document the merged hardening PRs and bump version:
- sanitize /api/validate-address response + input (#18)
- limit /api/network-info to public fields (#19)
- cap WebSocket frame size via maxPayload (#20)

Note: #20's TCP-peer WS-IP change was dropped on merge (would break the per-IP
WS cap behind the proxy); #16's trusted-proxy resolution is kept.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant