Skip to content

Limit exposed fields from getnetworkinfo to prevent metadata disclosure#19

Merged
NateIsern merged 1 commit into
mainfrom
codex/fix-network-info-api-vulnerability
Jun 25, 2026
Merged

Limit exposed fields from getnetworkinfo to prevent metadata disclosure#19
NateIsern merged 1 commit into
mainfrom
codex/fix-network-info-api-vulnerability

Conversation

@NateIsern

Copy link
Copy Markdown
Member

Motivation

  • The public /api/network-info endpoint previously returned the raw getnetworkinfo RPC response, which exposes node connectivity and deployment metadata unnecessary for the UI.
  • The frontend only consumes a few fields (connections/subversion/version/relayfee), so responses should be allowlisted to prevent fingerprinting and information disclosure.

Description

  • Add server/lib/network-info.ts with toPublicNetworkInfo and PublicNetworkInfo that validate and return only version, subversion, protocolversion, connections, and relayfee.
  • Update the server /api/network-info handler in server/index.ts to call toPublicNetworkInfo(blockCache.getNetworkInfo(network)) before responding.
  • Add server/lib/network-info.test.ts regression tests asserting that sensitive fields such as networks, localaddresses, and warnings are not exposed and malformed values are ignored.
  • Preserve existing API behavior for consumers while reducing the surface area of exposed node metadata.

Testing

  • Ran npm test and all tests passed (5 files, 44 tests passed).
  • Ran npm run typecheck and the TypeScript build/type-check completed successfully.
  • An initial npm test -- --runInBand invocation failed because vitest does not support the --runInBand flag, but this flag is unnecessary and the standard test run succeeded.

Codex Task

@NateIsern
NateIsern force-pushed the codex/fix-network-info-api-vulnerability branch from e0a3f4c to d6581e5 Compare June 25, 2026 19:45
@NateIsern
NateIsern merged commit 80225df into main Jun 25, 2026
1 check passed
@NateIsern
NateIsern deleted the codex/fix-network-info-api-vulnerability branch June 25, 2026 19:46
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