Repository navigation
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
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_TOKENset, the wallet answers a program's calls, and a web page only from a host the operator lists inALLOWED_ORIGINS.An operator whose browser application calls the wallet with no bearer token lists its host in
ALLOWED_ORIGINSand restarts the wallet; underserve-fleetthe variable is set in the process's environment, since a seat's.envline is not read. A program that calls a loopback wallet by a host name other thanlocalhostuses the address orlocalhost, lists the name, or setsAUTH_TOKEN.A wallet with
AUTH_TOKENset answers every call unchanged. WithAUTH_TOKENset, 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's3226368b2b27996c218e8828e43e4a36a1ba6734, the beta commit that bore the rule this is the stable line's form of: an originALLOWED_ORIGINSdoes 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 readsAccess-Control-Expose-Headersforhttps://app.example, which its router now lists asapp.example).What the host answers on five points, each pinned below:
.localhostis a DNS name like any other: on a loopback bind it is answered only whenALLOWED_ORIGINSlists it, and the inspector refuses it.Sec-Fetch-Siteline is read: a call is marked when any line carries a value other thansame-originornone(an unknown value, a list in one line, a line that is not text among them).Hostline and the request line's authority are judged, and each must pass; aHostline that is not text is refused.[::1]and[::1]:3322are the address, and[::1]evil.test,[::1]:evilor[::1]x:3322is a name, refused unless it is listed.browser_call_refusedline writes the caller'sHostandOriginquoted, 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/createActionfrom a public origin and from a loopback page of another port, not listed, is 403ORIGIN_NOT_ALLOWEDwith noaccess-control-*header.a_cross_site_get_public_key_from_an_origin_not_listed_is_refused_with_no_key: 403ORIGIN_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 noOriginis 403ORIGIN_NOT_ALLOWED.a_call_marked_on_any_sec_fetch_site_line_is_refused: from an origin not listed, the linessame-originandcross-sitein either order,cross-site, same-originin one line, and an unknown value are each 403ORIGIN_NOT_ALLOWED; lines ofsame-originandnonealone 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, elseother).a_programs_calls_are_answered_unchanged_with_no_grant: nine program calls at eight doors (Origin: http://localhost, no mark, JSON, and aHostline as a program sends it,localhost:3322and127.0.0.1:3322in turn), a fundedcreateActionamong them, each sent to the wallet with no bearer and to its twin with the bearer: the same status, body and headers but theaccess-control-*ones, of which the answer with no bearer carries none.a_listed_origin_is_granted_and_served: withALLOWED_ORIGINS=app.exampleits 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 403HOST_NOT_ALLOWED, and so iswallet.localhostwhen the list does not name it;localhost,LOCALHOST,localhost.,127.0.0.1and[::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: twoHostlines,localhostand a foreign name in either order, are 403HOST_NOT_ALLOWED; aHostline that is not text is 403; an absolute-form target naming a foreign name underHost: localhostis 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 blankHostanswered, as noHostis).the_refusal_line_writes_the_callers_host_and_origin_quoted: the refusal's line writes aHostand anOriginthat 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, across-sitemark 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/apireads underlocalhostand the addresses; its refusal's line writes the caller'sHostquoted.The routes
A browser sends without a preflight only a GET, or a POST whose type is
text/plain, a form's or none./createAction,/signAction,/abortAction,/internalizeAction,/relinquishOutputJsonextractor, 415 to any other type)/createSignature,/createHmac,/encrypt,/decrypt,/revealCounterpartyKeyLinkage,/revealSpecificKeyLinkage/acquireCertificate,/proveCertificate,/relinquishCertificate/getPublicKey,/verifySignature,/verifyHmac,/listActions,/listOutputs,/listCertificates,/discoverByIdentityKey,/discoverByAttributes,/getHeaderForHeight/permission-audit/reset/isAuthenticated,/getHeight,/getNetwork,/getVersion,/waitForAuthentication/permission-audit,/chain-feed,/tx/{txid}/arc-callbackThe 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)
The jobs only the pull request runs:
Build (ubuntu-latest)andTeston Linux,denywith 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