Skip to content

0.18.13: with no bearer token a served wallet answers a browser page only from a host the operator lists (GHSA-v9v8-f47p-46f8) - #738

Merged
Calgooon merged 3 commits into
mainfrom
lane/main-01813
Nov 29, 2026
Merged

Calgooon merged 3 commits into
mainfrom
lane/main-01813

Conversation

@Calgooon

Copy link
Copy Markdown
Contributor

This is the stable patch 0.18.13: one security fix of this crate, advisory GHSA-v9v8-f47p-46f8 (severity high), published with the release. Before this release a wallet served with no bearer token answered a web page of any origin.
With no AUTH_TOKEN set, the wallet answers a program's calls, and a web page only from a host the operator lists in ALLOWED_ORIGINS.
An operator whose browser application calls the wallet with no bearer token lists its host in ALLOWED_ORIGINS and restarts the wallet; under serve-fleet the variable is set in the process's environment, since a seat's .env line is not read. A program that calls a loopback wallet by a host name other than localhost uses the address or localhost, lists the name, or sets AUTH_TOKEN.
A wallet with AUTH_TOKEN set answers every call unchanged. With AUTH_TOKEN set, a call without the token is refused, on any version.

Commits

  • server: with no bearer token a web page is answered only from a host ALLOWED_ORIGINS lists. Class: security advisory. Its link names beta's 3226368b2b27996c218e8828e43e4a36a1ba6734, the beta commit that bore the rule this is the stable line's form of: an origin ALLOWED_ORIGINS does not name is refused and granted no cross-origin header, and a listed one is answered. Built by hand because the lines differ.
  • tests: what a wallet served with no bearer token answers a browser and a program. Class: security advisory. Its link names the same beta commit, which also bore the gate's tests of that rule (a listed origin answered, one not listed refused).
  • 0.18.13: ..., the version commit: Cargo.toml, Cargo.lock, CHANGELOG.md's section.

Tests

No existing test changed its name or its answer. Totals on the Studio Mac (macOS, arm64), cargo test --workspace --locked: 658 passed, 0 failed on 0.18.12's tree; 685 passed, 0 failed on this branch (27 new; the gate's unit tests run in both the library's and the binary's test targets).

One existing test's setup now lists its origin: server::handlers::tests::cors_exposes_retry_after (it reads Access-Control-Expose-Headers for https://app.example, which its router now lists as app.example).

What the host answers on five points, each pinned below:

  • A name under .localhost is a DNS name like any other: on a loopback bind it is answered only when ALLOWED_ORIGINS lists it, and the inspector refuses it.
  • Every Sec-Fetch-Site line is read: a call is marked when any line carries a value other than same-origin or none (an unknown value, a list in one line, a line that is not text among them).
  • Every Host line and the request line's authority are judged, and each must pass; a Host line that is not text is refused.
  • After a bracketed address only a port may follow: [::1] and [::1]:3322 are the address, and [::1]evil.test, [::1]:evil or [::1]x:3322 is a name, refused unless it is listed.
  • The browser_call_refused line writes the caller's Host and Origin quoted, so each reads as one field.

New tests, each by what the host answers:

  • a_preflight_from_an_origin_not_listed_is_refused_with_no_grant: a preflight to /createAction from a public origin and from a loopback page of another port, not listed, is 403 ORIGIN_NOT_ALLOWED with no access-control-* header.
  • a_cross_site_get_public_key_from_an_origin_not_listed_is_refused_with_no_key: 403 ORIGIN_NOT_ALLOWED, no key in the body, no grant.
  • a_cross_site_create_action_from_an_origin_not_listed_builds_nothing: on a funded wallet, 403; no action on record, nothing posted to the mock, the door not reached, the spending lock free.
  • a_same_site_create_action_from_another_loopback_port_is_refused: 403.
  • a_marked_call_is_refused_before_its_body_is_read: a marked call whose body is not JSON is the 403, not a body error.
  • a_marked_call_with_no_origin_is_refused: a marked call that carries no Origin is 403 ORIGIN_NOT_ALLOWED.
  • a_call_marked_on_any_sec_fetch_site_line_is_refused: from an origin not listed, the lines same-origin and cross-site in either order, cross-site, same-origin in one line, and an unknown value are each 403 ORIGIN_NOT_ALLOWED; lines of same-origin and none alone are answered.
  • the_mark_is_read_from_every_sec_fetch_site_line: the mark's own rows, the name it logs (cross-site, same-site, else other).
  • a_programs_calls_are_answered_unchanged_with_no_grant: nine program calls at eight doors (Origin: http://localhost, no mark, JSON, and a Host line as a program sends it, localhost:3322 and 127.0.0.1:3322 in turn), a funded createAction among them, each sent to the wallet with no bearer and to its twin with the bearer: the same status, body and headers but the access-control-* ones, of which the answer with no bearer carries none.
  • a_listed_origin_is_granted_and_served: with ALLOWED_ORIGINS=app.example its preflight is granted with the router's headers, its marked call is served, another port of the host is granted, a host not listed is refused.
  • allowed_origins_are_originators_or_refused: the 0.19 line's parsing rows (a scheme, a path, credentials, a query, a fragment, blanks, case) and the same refusal text.
  • a_loopback_wallet_answers_its_own_names_and_refuses_a_foreign_one: a foreign name is 403 HOST_NOT_ALLOWED, and so is wallet.localhost when the list does not name it; localhost, LOCALHOST, localhost., 127.0.0.1 and [::1] with a port are answered; a listed host (wallet.example, wallet.localhost) is answered; on a bind beyond loopback a name is answered; a request with no host is answered.
  • a_loopback_wallet_judges_every_host_line_and_the_authority: two Host lines, localhost and a foreign name in either order, are 403 HOST_NOT_ALLOWED; a Host line that is not text is 403; an absolute-form target naming a foreign name under Host: localhost is 403; one naming the address is answered.
  • the_host_rule_reads_the_name_without_its_port, the_host_rule_judges_every_host_line_and_the_authority, a_json_body_is_declared_by_its_type: the rules' own rows (after a bracketed address anything but a port refused; an empty or blank Host answered, as no Host is).
  • the_refusal_line_writes_the_callers_host_and_origin_quoted: the refusal's line writes a Host and an Origin that hold quotes as one quoted field each.
  • with_a_bearer_set_every_answer_is_the_bearers: a preflight is the bearer's 401 (a preflight carries no bearer); a marked call with the bearer is served with the grant; without it, 401; a named host is answered.
  • the_arc_callback_reaches_its_handler_under_any_name_and_mark: under a foreign name, a cross-site mark and no wallet bearer it is answered by its own token's handler.
  • a_body_not_declared_json_is_not_served_at_a_door_that_signs_or_changes_state: text/plain, a form's type or none at each such door is 415.
  • the_inspector_answers_its_own_names_and_refuses_a_foreign_one: the inspector refuses a foreign name and a name under .localhost, and answers its page and its /api reads under localhost and the addresses; its refusal's line writes the caller's Host quoted.

The routes

A browser sends without a preflight only a GET, or a POST whose type is text/plain, a form's or none.

route method body what it does
/createAction, /signAction, /abortAction, /internalizeAction, /relinquishOutput POST JSON (the Json extractor, 415 to any other type) spends, signs, writes or deletes
/createSignature, /createHmac, /encrypt, /decrypt, /revealCounterpartyKeyLinkage, /revealSpecificKeyLinkage POST JSON signs or reveals key material
/acquireCertificate, /proveCertificate, /relinquishCertificate POST JSON writes, reveals or deletes certificates
/getPublicKey, /verifySignature, /verifyHmac, /listActions, /listOutputs, /listCertificates, /discoverByIdentityKey, /discoverByAttributes, /getHeaderForHeight POST JSON read
/permission-audit/reset POST none read; now 415 unless it declares JSON clears the audit record
/isAuthenticated, /getHeight, /getNetwork, /getVersion, /waitForAuthentication GET, POST none read
/permission-audit, /chain-feed, /tx/{txid} GET none read
/arc-callback POST its own token, then JSON writes a broadcaster's status; outside the browser gate

The inspector (bsv-wallet ui): /, /api/tables, /api/tables/{name}, /api/tables/{name}/schema, /api/stats (GET, read) and /api/query (POST, JSON, read).

The proof, on this branch's tree (the Studio Mac)

cargo fmt --all -- --check
fmt: ok
cargo clippy --workspace --all-targets --locked -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 15.84s
cargo test --workspace --locked
passed 685 failed 0 ignored 0
cargo test --locked --test arcade_webhook_vector_tests
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
cargo test --locked --lib gift::covenant::tests::
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 237 filtered out
locks: Cargo.lock: 1 bsv-rs
deny: template hash ok; cargo deny --locked check (0.19.0 on this host)
advisories ok, bans ok, licenses ok, sources ok
cargo build --release --locked; cargo build --release --locked -p bsv-wallet-mcp
    Finished `release` profile [optimized] target(s)
python3 -B .github/ci/test_lines.py
lines: 26 cases
bash .github/ci/lines.sh beta-born
every commit of the pull request is on beta by sha, patch or cherry-pick link, or is a hop commit or a version commit
cargo publish --dry-run --locked -p bsv-wallet-cli
warning: aborting upload due to dry run

The jobs only the pull request runs: Build (ubuntu-latest) and Test on Linux, deny with cargo-deny 0.20.2, and on the tag the release workflow's binaries for the other targets.

The landing, the door run, the mainnet gate, the tag, the advisory's publication and the link on beta are the captain's.

🤖 Generated with Claude Code

Calgooon and others added 3 commits November 29, 2026 11:46
…ALLOWED_ORIGINS lists

A security fix, advisory GHSA-v9v8-f47p-46f8. With no AUTH_TOKEN set the
served wallet answers a program's calls and refuses a web page's, unless
the page's host is one the operator names:

- ALLOWED_ORIGINS, read at start beside AUTH_TOKEN: comma-separated
  originators, a host with an optional port and no scheme, lowercased,
  each its hostname's grant (every port of that host); an entry with a
  scheme, credentials, a path, a query or a fragment refuses the start,
  naming the rule; unset or blank lists none. The same name, the same
  entry form and the same refusal text as the 0.19 line's list. On this
  line it governs a browser's calls alone.
- A call its browser marks as leaving its page (a preflight, or a
  Sec-Fetch-Site line whose value is not same-origin or none: cross-site,
  same-site, an unknown value, a list in one line, a line that is not
  text; every line is read) from an Origin whose host is not listed, or
  with no Origin, is refused before its body is read, before
  the start's heal and the spending lock: 403 ORIGIN_NOT_ALLOWED, the
  message saying what the operator does, one browser_call_refused line at
  warn, the caller's Host and Origin written quoted.
- On a loopback bind, a request addressed to a DNS name other than
  localhost or a listed host is refused the same way, 403
  HOST_NOT_ALLOWED; a .localhost name passes only when listed; an address
  literal passes, and after a bracketed one only a port may follow.
  Every Host line and the request line's authority are judged, and each
  must pass; a Host line that is not text is refused. A
  bind beyond loopback is not judged.
- An origin the list does not name gets no access-control-* header, on a
  preflight and on an answer alike; a listed origin's headers are
  unchanged.
- POST /permission-audit/reset asks for a JSON body as every other door
  that changes state does: a request that declares none is 415.
- POST /arc-callback carries its own token and is outside both refusals.
- With AUTH_TOKEN set none of this runs: the bearer is the guard.
- The inspector (bsv-wallet ui) takes the same host rule with no list:
  localhost and an address are answered, any other name (a .localhost
  name among them) is refused. It grants no cross-origin call.

ServerConfig's fields are unchanged, so a crate that builds it compiles
unchanged; the list rides beside it (make_router_listing, run_listing),
and make_router and run list none. The CORS test that reads the exposed
Retry-After lists its caller's host in its own setup.

This is the stable line's form of the 0.19 line's rule that an origin the
list does not name is refused and granted nothing and a listed one is
answered, built by hand because the lines differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3226368)
…d a program

A security fix's tests, advisory GHSA-v9v8-f47p-46f8. Each request goes
through the real router in process, over an in-memory store whose
services are the toolbox's mock; every spend is noSend. What the host
answers:

- a preflight to /createAction from a public origin, or from a loopback
  page of another port, not listed: 403 ORIGIN_NOT_ALLOWED, no
  access-control-* header;
- a cross-site /getPublicKey from an origin not listed: 403, no key;
- a cross-site /createAction on a funded wallet: 403, no action on
  record, nothing posted, the door not reached, the spending lock free;
- the same marked same-site from another loopback port: 403;
- a marked call whose body is not JSON: the 403, not a body error;
- a marked call that carries no Origin: 403;
- a call marked on any Sec-Fetch-Site line from an origin not listed:
  the lines same-origin and cross-site in either order, the one line
  "cross-site, same-origin", an unknown value: each 403; lines of
  same-origin and none alone: answered;
- a program's calls (Origin http://localhost, no mark, JSON, a Host line
  localhost:3322 or 127.0.0.1:3322 as a program sends it): the status,
  body and headers of the bearer's answer, a funded createAction among
  them, with no access-control-* header;
- a listed origin (ALLOWED_ORIGINS=app.example): its preflight granted
  with the router's headers, its marked call served, another port of the
  host granted, a host not listed refused;
- the list's parsing: the 0.19 line's rows (a scheme, a path,
  credentials, blanks, case) and the same refusal text;
- the host rule on a loopback bind: a foreign name 403 HOST_NOT_ALLOWED,
  and a .localhost name not listed the same; localhost in any case, with
  a trailing dot, and the addresses with a port answered; a listed host
  (wallet.example, wallet.localhost) answered; beyond loopback a name
  answered; no host answered; after a bracketed address anything but a
  port ([::1]evil.test, [::1]:evil, [::1]x:3322) refused;
- every Host line and the authority judged: two Host lines, localhost
  and a foreign name in either order, 403; a Host line that is not text,
  403; an absolute-form target naming a foreign name under Host:
  localhost, 403; one naming the address, answered;
- with a bearer set every answer is the bearer's;
- /arc-callback under a foreign name and a cross-site mark reaches its
  handler;
- a body not declared JSON at each door that signs, spends, writes or
  deletes, /permission-audit/reset among them: 415;
- the inspector: a foreign name and a .localhost name refused, its page
  and its /api reads under localhost and the addresses answered;
- the refusal's warn line, the gate's and the inspector's, writes the
  caller's Host (and the gate's the Origin) quoted.

These tests are new on this line: the stable line's own, written by
hand for the rule that the named commit of the 0.19 line bore with its
own tests, because the lines differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3226368)
…only from a host ALLOWED_ORIGINS lists (GHSA-v9v8-f47p-46f8)

The version commit of the stable patch 0.18.13: version = "0.18.13" in
Cargo.toml, this crate's row in Cargo.lock, and CHANGELOG.md's section for
the release, directly above 0.18.12's.

The section says, in an operator's words, that this release is one
security fix of this crate (advisory GHSA-v9v8-f47p-46f8, severity high,
published with the release), who should act (anyone who runs daemon or
serve without AUTH_TOKEN on a machine where a web browser is used), what
the host does now, what an operator must do (a browser application's
host in ALLOWED_ORIGINS; a program that calls a loopback wallet by a
host name other than localhost uses the address or localhost, lists the
name, or sets AUTH_TOKEN), what does not change, the 0.19 line's list,
and the way back. No pin moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Calgooon
Calgooon merged commit ee0382f into main Nov 29, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant