{"id":"XE-8457","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":1727,"title":"`xe lease` ignores `XE_NODE` and submits the signed lease block to a hard-coded public testnet node","area":"sdk-docs-web","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-11T22:51:59.158094+00:00","updated_at":"2026-11-17T09:42:07.630590+00:00","source_created_at":null,"told_at":"2026-11-17T09:42:07.653805+00:00","status_changed_at":"2026-11-17T09:42:07.637579+00:00","url":"https://bounty.xe.network/XE-8457","body":"## Summary\r\n\r\nThe 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\").\r\n\r\n`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:\r\n\r\n```go\r\n// cmd/xe/main.go:1744\r\nfunc pickSubmitNode(c *client.Client, providerAddr string) string {\r\n\tallNodes := []string{\r\n\t\t\"https://ldn.core.test.network\",\r\n\t\t\"https://ffm.core.test.network\",\r\n\t\t\"https://nyc.core.test.network\",\r\n\t}\r\n\tfor _, n := range allNodes {\r\n\t\tnc := client.New(n)\r\n\t\tinfo, err := nc.NodeInfo()\r\n\t\t...\r\n\t\tif addr, ok := info[\"address\"].(string); ok && addr != providerAddr {\r\n\t\t\treturn n\r\n\t\t}\r\n\t}\r\n\treturn nodeURL()\r\n}\r\n```\r\n\r\n`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.\r\n\r\nConsequences:\r\n\r\n1. **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.\r\n2. **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.\r\n3. **Unrequested network traffic:** three extra `GET /node` calls to fixed hosts on every `xe lease`.\r\n\r\n## Steps to reproduce (no funds, no block submission)\r\n\r\nUsing 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):\r\n\r\n```go\r\n// cmd/xe/zz_probe_test.go\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"; \"net/http\"; \"net/http/httptest\"; \"os\"; \"testing\"\r\n\t\"github.com/xeprotocol/xe/client\"\r\n)\r\n\r\nfunc TestProbePickSubmitNode(t *testing.T) {\r\n\thits := 0\r\n\tmock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\r\n\t\thits++\r\n\t\tw.Write([]byte(`{\"address\":\"mock-node\",\"network_id\":\"xe-devnet\"}`))\r\n\t}))\r\n\tdefer mock.Close()\r\n\tos.Setenv(\"XE_NODE\", mock.URL)\r\n\tc := client.New(nodeURL())\r\n\tfmt.Println(\"XE_NODE =\", nodeURL())\r\n\tfmt.Println(\"pickSubmitNode returned:\", pickSubmitNode(c, \"0000000000000000000000000000000000000000000000000000000000000000\"))\r\n\tfmt.Println(\"mock hits:\", hits)\r\n}\r\n```\r\n\r\n```bash\r\ngo test ./cmd/xe -run TestProbePickSubmitNode -v -count=1\r\n```\r\n\r\n## Evidence\r\n\r\nRun 12 Nov 2026 05:49 WIB:\r\n\r\n```\r\n=== RUN   TestProbePickSubmitNode\r\nXE_NODE = http://127.0.0.1:41163\r\npickSubmitNode returned: https://ldn.core.test.network\r\nmock hits: 0\r\n--- PASS: TestProbePickSubmitNode (1.37s)\r\n```\r\n\r\nThe 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\")`).\r\n\r\n## Expected vs actual\r\n\r\n- **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.\r\n- **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.\r\n\r\n## Impact\r\n\r\n- Leaks the user's lease intent (signed block, SSH access pubkey, IP) to third-party nodes the user did not configure.\r\n- 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.\r\n- Mixes nodes within one command (submit to `ldn`, poll `XE_NODE`), producing false \"not accepted\" warnings when nodes disagree.\r\n\r\nNo funds, keys, or other users were involved.\r\n\r\n## Suggested fix\r\n\r\nRemove 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.\r\n\r\n## Dedup\r\n\r\nSearched 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:\r\n\r\n- XE-8014 — `pickProvider` ignores the provider-ad timestamp (provider choice, not submit node).\r\n- XE-1248 — `xe lease` silently ignores unknown flags.\r\n- XE-7541 — no `lease_cancel` path in the CLI.\r\n- XE-0121 / XE-2706 / XE-6695 — `GetChain` status-blindness (prev=0) in send/lease.\r\n\r\nCaveat: private tickets cannot be searched.","patch_refs":[],"thread":[{"id":9877,"source":"desk","source_ref":"reply:8315","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-8457 and says what differs; it is read like any other.","created_at":"2026-11-17T09:42:07.630590+00:00"}]}