Bounty
XE-8457 · Bounty

`xe lease` ignores `XE_NODE` and submits the signed lease block to a hard-coded public testnet node

Closed · duplicate —claimed Minor web filed 2026-11-11 22:51 UTC by away7000

Report

Summary

The docs say XE_NODE is the "Node API URL for every client command" and that "every other subcommand is a client that talks to a node's HTTP API (XE_NODE …)" (docs/cli.md lines 5 and 85; README line 283: "XE_NODE selects the HTTP API for client commands").

xe lease does not honour that for the one request that matters. After building and signing the lease block against the configured node (network id, balances, chain, certificate are all read from XE_NODE), it calls pickSubmitNode(), which ignores XE_NODE and tries three hard-coded public hosts:

// cmd/xe/main.go:1744
func pickSubmitNode(c *client.Client, providerAddr string) string {
	allNodes := []string{
		"https://ldn.core.test.network",
		"https://ffm.core.test.network",
		"https://nyc.core.test.network",
	}
	for _, n := range allNodes {
		nc := client.New(n)
		info, err := nc.NodeInfo()
		...
		if addr, ok := info["address"].(string); ok && addr != providerAddr {
			return n
		}
	}
	return nodeURL()
}

cmdLease then posts the signed block there (main.go:1086–1088). XE_NODE is only used as a last-resort fallback when all three public hosts are unreachable. The c argument (the configured client) is never used.

Consequences:

  1. Private / local / future-mainnet nodes: a user who points XE_NODE at their own node, a devnet, or a later network still has their signed lease block (account, provider, amount, dimensions, AccessPubKey, certificate hash) sent to the public testnet operators, and their IP contacts three hosts they never configured. The block is signed with the configured node's network_id (initNetworkID() reads it from XE_NODE), so on any other network the submit is rejected by the testnet node and xe lease fails with an error from a node the user never chose.
  2. Choice of testnet node is overridden: XE_NODE=https://nyc.core.test.network xe lease … still submits to ldn (first reachable host). Status polling (GetLease) then reads from nyc, so during propagation lag or a node split (see e.g. the ldn/ffm/nyc divergence in XE-6354) the CLI can print "WARNING: not accepted within 120s" for a lease that ldn accepted, or vice versa.
  3. Unrequested network traffic: three extra GET /node calls to fixed hosts on every xe lease.

Steps to reproduce (no funds, no block submission)

Using the official source at 89a542e, drop this throwaway test next to main.go (it only calls pickSubmitNode; nothing is signed or submitted — it makes three GET /node reads):

// cmd/xe/zz_probe_test.go
package main

import (
	"fmt"; "net/http"; "net/http/httptest"; "os"; "testing"
	"github.com/xeprotocol/xe/client"
)

func TestProbePickSubmitNode(t *testing.T) {
	hits := 0
	mock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		hits++
		w.Write([]byte(`{"address":"mock-node","network_id":"xe-devnet"}`))
	}))
	defer mock.Close()
	os.Setenv("XE_NODE", mock.URL)
	c := client.New(nodeURL())
	fmt.Println("XE_NODE =", nodeURL())
	fmt.Println("pickSubmitNode returned:", pickSubmitNode(c, "0000000000000000000000000000000000000000000000000000000000000000"))
	fmt.Println("mock hits:", hits)
}
go test ./cmd/xe -run TestProbePickSubmitNode -v -count=1

Evidence

Run 12 Nov 2026 05:49 WIB:

=== RUN   TestProbePickSubmitNode
XE_NODE = http://127.0.0.1:41163
pickSubmitNode returned: https://ldn.core.test.network
mock hits: 0
--- PASS: TestProbePickSubmitNode (1.37s)

The configured node received zero requests; the function chose https://ldn.core.test.network. In cmdLease, that return value is the URL the signed lease block is POSTed to (submitClient := client.New(submitURL); submitClient.SubmitBlock(b, "lease")).

Expected vs actual

  • Expected: every client command, including xe lease, talks to XE_NODE (as documented). If the intent is "don't submit to the provider's own node", pick among nodes the user configured (e.g. a XE_SUBMIT_NODE override, or just XE_NODE unless it is the provider) and never fall through to hard-coded hosts.
  • Actual: the signed lease is submitted to the first reachable of three hard-coded public testnet nodes; XE_NODE is used only if all three are down.

Impact

  • Leaks the user's lease intent (signed block, SSH access pubkey, IP) to third-party nodes the user did not configure.
  • Breaks xe lease on any network other than the public testnet (private devnet, local cluster, and, if unchanged, mainnet), because the block is signed for XE_NODE's network id but submitted elsewhere.
  • Mixes nodes within one command (submit to ldn, poll XE_NODE), producing false "not accepted" warnings when nodes disagree.

No funds, keys, or other users were involved.

Suggested fix

Remove the hard-coded list. Submit to nodeURL(); if the provider-node exclusion is required, compare c.NodeInfo()["address"] with the provider and fail with a clear message (or accept an explicit XE_SUBMIT_NODE), rather than silently switching hosts.

Dedup

Searched all 1,444 public bounty tickets (GET /v1/tickets?kind=bounty&status=all, refreshed 12 Nov 2026 05:47 WIB) for pickSubmitNode, XE_NODE, hardcoded/hard-coded, submit node, ffm, nyc, custom/local node, devnet. Nothing covers the lease submit ignoring XE_NODE. Nearby but different:

  • XE-8014 — pickProvider ignores the provider-ad timestamp (provider choice, not submit node).
  • XE-1248 — xe lease silently ignores unknown flags.
  • XE-7541 — no lease_cancel path in the CLI.
  • XE-0121 / XE-2706 / XE-6695 — GetChain status-blindness (prev=0) in send/lease.

Caveat: private tickets cannot be searched.

Thread

Joseph Denneteam2026-11-17 09:42 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-8457 and says what differs; it is read like any other.