<!-- XE-0055 · api/deploy: public testnet nodes ship the dev CORS origin http://localhost:3000, so the SDK cannot run in a browser (Minor) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0055>. The page is the record; this is the same page for reading.*

XE-0055 · Bounty

# api/deploy: public testnet nodes ship the dev CORS origin http://localhost:3000, so the SDK cannot run in a browser (Minor)

Accepted
claimed Minor
[xe#75](https://github.com/xeprotocol/xe/issues/75)
filed 2026-10-26 20:11 UTC
by BoomGone

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Minor

Area
:   Node / API

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-10 11:38 UTC

Told
:   2026-11-10 00:15 UTC

### Patches

- [xe#123](https://github.com/xeprotocol/xe/pull/123) open by arturbarszcz78
  fix(api): default CORS origin to wildcard, support origin lists, and align docs (#75)

### History

- [61388](https://bounty.xe.network/log/61388) 2026-11-10 00:15 UTC reply.mirrored
- [61345](https://bounty.xe.network/log/61345) 2026-11-10 00:15 UTC reply.sent
- [17812](https://bounty.xe.network/log/17812) 2026-11-07 16:07 UTC proposal.adopted
- [17811](https://bounty.xe.network/log/17811) 2026-11-07 16:07 UTC ticket.award
- [17810](https://bounty.xe.network/log/17810) 2026-11-07 16:07 UTC proposal.rejected
- [6887](https://bounty.xe.network/log/6887) 2026-11-05 13:45 UTC proposal.created
- [1812](https://bounty.xe.network/log/1812) 2026-11-02 19:16 UTC proposal.created
- [1466](https://bounty.xe.network/log/1466) 2026-11-02 10:11 UTC note.added
- [734](https://bounty.xe.network/log/734) 2026-10-29 14:22 UTC note.added
- [733](https://bounty.xe.network/log/733) 2026-10-29 14:22 UTC ticket.facts area
- [628](https://bounty.xe.network/log/628) 2026-10-29 14:05 UTC github.labels
- [405](https://bounty.xe.network/log/405) 2026-10-29 14:04 UTC ticket.status triaging → accepted

[Full history](https://bounty.xe.network/log?ref=XE-0055) · [JSON](https://bounty.xe.network/v1/tickets/XE-0055) · [markdown](https://bounty.xe.network/XE-0055.md)

### Report

- **Suggested tier:** Minor (possibly Medium as an API inconsistency)
- **Area:** api (CORS), testnet deployment, docs
- **Tested:** 2026-10-26, nodes report `xe/92d83d1`, repo master `9787859`

## Summary

Every public testnet endpoint answers with `Access-Control-Allow-Origin: http://localhost:3000`, whatever the request `Origin` is. Browsers therefore refuse every response to any web page not served from exactly `http://localhost:3000`. The SDK README says it "works in Node and in a browser, on the same code path" and its examples point at `https://ldn.core.test.network`, so a browser app built from those examples fails on every call.

The cause is a hardcoded fallback in the node: when `--cors-origin` is not set, the API uses `http://localhost:3000`. The CLI reference on the site says the default is "(none)", which contradicts both the code and `docs/api.md`.

## Evidence

Code (`api/handler.go`, master `9787859`):

```
origin := h.corsOrigin
if origin == "" {
    origin = "http://localhost:3000"
}
```

Docs that disagree with each other:

- `docs/api.md:27`: "allowed origin is configurable (default `http://localhost:3000`)"
- https://test.network/docs/cli, table "API, UI and operator listeners": `--cors-origin` default `(none)`
- SDK README (github.com/xeprotocol/sdk): "It works in Node and in a browser, on the same code path", example `new Xe({ client: 'https://ldn.core.test.network', wallet })`

Live headers, request sent with `Origin: https://myapp.example`:

| Endpoint | Status | Access-Control-Allow-Origin |
| --- | --- | --- |
| `OPTIONS https://ldn.core.test.network/blocks/send` | 204 | `http://localhost:3000` |
| `GET https://ldn.core.test.network/node` | 200 | `http://localhost:3000` |
| `OPTIONS https://ffm.core.test.network/blocks/send` | 204 | `http://localhost:3000` |
| `GET https://ffm.core.test.network/node` | 200 | `http://localhost:3000` |
| `OPTIONS https://nyc.core.test.network/blocks/send` | 204 | `http://localhost:3000` |
| `GET https://nyc.core.test.network/node` | 200 | `http://localhost:3000` |
| `GET https://test.network/api/v1/health` | 200 | `http://localhost:3000` |

## Steps to reproduce

1. Save the page below as `cors-poc.html`. It calls `GET /node` on the three core nodes and on the test.network proxy.
2. Serve it from any origin other than `localhost:3000`, for example `python3 -m http.server 8765 --bind 127.0.0.1`, and open `http://127.0.0.1:8765/cors-poc.html`.
3. Result: all four requests fail with `TypeError: Failed to fetch`, and the console shows a CORS error.
4. Control: serve the same file with `python3 -m http.server 3000` and open `http://localhost:3000/cors-poc.html`. All four return `OK 200`.

```
<!doctype html><meta charset="utf-8"><title>XE CORS PoC</title>
<pre id="out">running</pre>
<script>
// Fetch a public read endpoint from a page whose origin is not http://localhost:3000.
const nodes = ['https://ldn.core.test.network/node','https://ffm.core.test.network/node','https://nyc.core.test.network/node','https://test.network/api/v1/node'];
(async () => {
  const lines = ['page origin: ' + location.origin];
  for (const u of nodes) {
    try { const r = await fetch(u); lines.push('OK ' + r.status + ' ' + u); }
    catch (e) { lines.push('BLOCKED ' + u + ' (' + e.name + ': ' + e.message + ')'); }
  }
  document.getElementById('out').textContent = lines.join('\n');
})();
</script>
```

Observed with headless Chrome on 2026-10-26:

```
page origin: http://127.0.0.1:8765
BLOCKED https://ldn.core.test.network/node (TypeError: Failed to fetch)
BLOCKED https://ffm.core.test.network/node (TypeError: Failed to fetch)
BLOCKED https://nyc.core.test.network/node (TypeError: Failed to fetch)
BLOCKED https://test.network/api/v1/node (TypeError: Failed to fetch)

page origin: http://localhost:3000
OK 200 https://ldn.core.test.network/node
OK 200 https://ffm.core.test.network/node
OK 200 https://nyc.core.test.network/node
OK 200 https://test.network/api/v1/node
```

## Impact

- Any browser dApp, explorer or agent UI built on the SDK fails against the public testnet unless it happens to run on `localhost:3000`. The documented browser support does not work in practice.
- No security impact found: the setting is more restrictive than intended, not less. Reads are public anyway, and writes are signed client side.
- A side effect worth noting: any page a user runs on `localhost:3000` (a common dev port) is the one origin trusted by every public node.

## Suggested fix

1. Pick an intended default and make the code, `docs/api.md` and the CLI reference agree. For a public read API with no cookies, `Access-Control-Allow-Origin: *` is the usual choice; or default to no CORS header, as the CLI reference claims.
2. Set `--cors-origin` explicitly on the public testnet nodes.
3. Optionally allow a list of origins and echo the matching one with `Vary: Origin`.

## Relation to existing issues

#70 mentions the fixed `localhost:3000` header in passing, as a reason a third party page cannot read responses. This report is about the header itself as a defect: it breaks the documented browser support of the SDK on every public node, and the CLI reference and `docs/api.md` disagree on the default.

## Payout

XE address: `6591eab453dbd93b27e2cd674712f94b42d9e7e4d52980b966fa6da4ccd832dc`

This is an ed25519 address derived as in `core/crypto.go`. Could you confirm it will be valid for the mainnet payout, or tell me if you need a separately designated mainnet address?

### Thread

**XE desk**team2026-11-10 00:15 UTCgithub

Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is
updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0055.
