Files
adaptive-music/evidence/CROSS-ORIGIN-INVESTIGATION.md
T
Jason 1ed30567fb
Validate and generate manual release / package (push) Waiting to run
Release v0.7.0 - Automatic pairing and validated MA audio playback
2026-12-04 08:58:47 -05:00

6.7 KiB

v0.6.0 connection investigation — 2026-12-03

Historical report. The expanded authorization and v0.7.0 implementation supersede its pending-credential and provisioning status. See v0.7.0-live.json and current PROGRESS.md for the actual live results and unresolved private-route/MA-media checks.

Status: working-tree remediation; not a release and not live acceptance. No production credentials, services, routes, players or queues were used/changed. The pre-existing uncommitted v0.6.0 work has been preserved.

Reported deployment evidence

The operator reports trusted Let's Encrypt HTTPS, Nginx WebSocket HTTP 101, responding MA 2.10.6, functioning private access restrictions, and Firefox success from MA's origin but failure from Foundry's origin. VPN removal, DNS clearing and local-network permission did not resolve it. This supersedes the old assumption that missing TLS is the remaining infrastructure problem. These facts are operator reports, not independently observed request/response captures.

What is established

Pinned MA 2.10.6 commit c24866405bd2068c25a60e1014e5ef8c3f6445bb has no explicit Origin allowlist in its inspected API WebSocket and authenticated Sendspin proxy handlers. The API authenticates a correlated auth command after upgrade; the Sendspin proxy authenticates a first text frame, then Noise/Sendspin follows. Neither a homepage response nor a separate client's HTTP 101 establishes that the Foundry-origin browser reaches either authenticated stage. HTTP CORS headers are not a WebSocket Origin authorization fix.

Real Firefox 144.0.2 exercised two distinct HTTPS origins (localhost and 127.0.0.1, separate ports) and WSS, with a local CA trusted only in an isolated browser profile. No ignore-certificate setting, security-disabled flag or production endpoint was used. cross-origin-browser.json records the six passing scenarios:

Scenario Browser observation
Trusted cross-origin WSS, policy allows target Both routes open
Enforced connect-src self Both blocked; no server upgrade
MA same-origin control Both open
Report-only connect-src self Both open
Server rejects the Foundry Origin Both fail opaquely
Same-origin under that Origin restriction Both open

The local server implements a real RFC 6455 upgrade and close, not MA's API, Noise or audio. This is evidence about browser enforcement and diagnostics, not MA/Foundry integration. It exposed a synchronous SecurityError/asynchronous CSP event ordering issue that mocks missed; diagnostics now allow time for that event. Browser WebSocket APIs conceal HTTP status, TLS errors and arbitrary close causes. An opaque failure cannot be truthfully labeled an Origin rejection or TLS problem.

Defect status

Defect Change/evidence Still required
AM-001 Scoped ApplicationV2 label/input/button sizing, narrow-window overflow and hidden-step checks at 380/640/1000px Actual Foundry v14 theme/window verification
AM-002 Corrected research: public sendspin/pair_web_player exists and binds pairing to an account Implement and validate dedicated creation/pairing; backup import remains required
AM-003 Credential-free in-interface checks for each route; enforced CSP identification; separate API upgrade/auth denial/auth timeout/disconnect/command and Sendspin auth/sync messages Deployed failures and Noise errors must be observed; opaque transport errors stay explicitly uncertain
AM-004 Draft persists in closure memory across failed tests and setup rerenders; retry regression; explicit forget; no token reuse across origin changes; concurrent tests rejected Actual Foundry window lifecycle check; reload intentionally clears secrets
AM-005 Real HTTPS Firefox reproductions and actionable stage diagnostics Exact deployed root cause, correction and live regression are unresolved

Provisioning correction and blockers

The earlier SENDSPIN-PROVISIONING research considered virtual players but missed providers/sendspin/provider.py:894 and command registration at :1048. sendspin/pair_web_player(pairing_token) requires PLAYERS_CONTROL, waits for the connected registered browser client, checks is_web_player, and pairs using the calling account as owner. The SDK exposes pairingToken and generates a stable identity with its supplied storage. This offers a source-supported route to integrated provisioning without grouping, household enumeration or another service.

It is not implemented here. A correct flow must explicitly create only a new campaign-owned identity, connect the Sendspin transport before target lookup, submit only that identity's pairing token, await completed Noise activation and clock sync, verify exact identity/name/provider/standalone topology, retain the updated SDK storage in memory, and offer a private backup export. Disconnect, failed pairing, receiver persistence and restart semantics need real MA testing. The current flow instead looks up an existing identity before connecting it. Merely removing the backup requirement would fail or create an unpaired target. No broad players list or queue control should be added to solve this.

AGENTS.md also places MA access on a gateway, while the inherited v0.6.0 browser host puts credentials in the GM tab. This existing architectural conflict is not resolved by a WebSocket patch. Adding an unrestricted same-origin MA reverse proxy would violate the stated boundary and is not an adopted solution. An actual server-side gateway cannot be installed by Foundry's browser-only module API. No new mandatory service is proposed.

Next acceptance decision

Obtain the current Foundry and trusted MA origins and explicit read-only credential permission (requested in chat; not received during these checks). Inspect the actual page's enforced response/meta CSP and test both routes from that page in Firefox. Compare the same browser's MA-origin result, not curl or a synthetic page. If CSP is confirmed, prepare an exact-origin connect-src amendment to the existing policy for operator review. If the handshake reaches the proxy and is rejected, inspect the exact Origin against private route policy. Never strip/forge Origin, allow every origin, disable browser security or expose an unrestricted MA proxy. Any production configuration amendment requires separate approval before applying.

Only after the observed blocker is corrected should authentication, owned receiver creation/pairing, catalog load, interrupted retry and approved audio/restore testing be accepted. Credential approval for read-only tests does not authorize provisioning or playback. The existing Gitea URL/update mechanism is unchanged. Do not publish a new version or replace the existing v0.6.0 immutable artifact on this evidence.