Skip to content

There is no way to narrow the RPC surface to what a wallet needs, so a public node exposes debug_trace* to anonymous callers #419

Backlog

Description

@SDL-A1

crates/rpc/src/server.rs:545-547, and the absence of any allowlist mechanism.

A node that serves wallets needs to expose about nine methods. Today the only
way to narrow the surface is --rpc-admin, which gates exactly six:

"rsk_collectTrie" | "rsk_collectTrieStatus" | "rsk_pruneBlocks" | "rsk_storageStatus"
| "rsk_flush" | "rsk_shutdown"
    if !state.admin_enabled =>

Everything else is reachable by anonymous callers, including
debug_traceTransaction, debug_traceBlockByHash and
debug_traceBlockByNumber (server.rs:630-632), eth_getLogs, eth_call
and eth_estimateGas. There is no allowlist or denylist of any kind, no
authentication, and no rate limiting in the RPC layer. CORS is already
permissive() on both the HTTP and WebSocket handlers, so a browser can call
a node directly — which makes a publicly reachable node a realistic
deployment rather than a hypothetical one.

Why it is worth an issue

Because the alternative is that every operator writes an allowlist in a proxy,
and a proxy cannot price a method. It sees one rsk_lastAccountChange as
one HTTP request. The node knows that call is up to twenty-four internal round
trips, which is exactly why it already ships behind
--rpc-account-search. A proxy would rate-limit the ruinous and the trivial
identically.

A proxy allowlist also drifts. Every method added to the node is a method the
proxy does not know about, and if anyone writes it as a denylist the drift is
silent and in the permissive direction.

The node already does this job four times over, so this is a fifth instance of
an existing pattern rather than a new idea: --rpc-admin,
--rpc-account-search, --dev-rpc for the evm_ namespace, and
--rpc-logs-max-blocks as a per-method bound.

What would settle it

A --rpc-wallet profile that serves only what a verifying client needs, and
refuses the rest with "Method not found" as --rpc-account-search already
does. The list is small:

method for
eth_getProof balances, nonces, storage — the whole verified state path
a header range with uncles following the chain (#417)
eth_getBlockReceipts receipt-set completeness (#396)
rsk_lastAccountChange the history hint
eth_sendRawTransaction broadcast
eth_estimateGas, eth_gasPrice building a transaction
eth_chainId, eth_blockNumber, eth_syncing identity and freshness
eth_subscribe / eth_unsubscribe new heads, so a client need not poll

Per-method bounds belong with it, in the spirit of --rpc-logs-max-blocks:
a cap on the header range, and a cap or cooldown on the account search, which
is the one method here that costs the server more than it costs the caller.

Notes

Found while asking whether an SPV wallet needs a service in front of a node,
or whether it can talk to one directly. It can, except for this: a bare node
cannot be narrowed to a wallet's needs, and that — not TLS, not CORS — is the
reason a proxy would otherwise be mandatory.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions