Files
adaptive-music/SECURITY.md
T

133 lines
8.7 KiB
Markdown
Raw Normal View History

2026-12-03 16:11:47 -05:00
# Security — standalone module and optional host fallback
The module installs through the normal Foundry manifest/ZIP mechanism. No runtime
Docker/VM/LXC, sandbox host, third-party Foundry module, core modification, service
installer or public MA endpoint is required or created. The optional companion is
retained as experimental source/branch, not a mandatory backend. Co-located host
placement/routing/manual service setup is a proposal requiring separate approval.
## Trust boundaries
Only an elected single active GM may initiate GM-local MA access. The GM explicitly
supplies a memory-only private profile; that GM/browser user can inspect its token,
identity and private data. JavaScript private fields are not a secret store against
the browser owner, debugger, compromised same-origin code or server administrator.
No contrary claim is made. Trust all code served into the GM origin. A player never
receives the GM's MA token/profile, SDK private key, upstream URL or queue payload.
Profiles/tokens are not persisted in Foundry settings, flags, localStorage, sockets,
logs, release files or URLs. Operator private backups belong outside the module's
public files; existing development secrets stay under ignored `.local/` (0700,
regular owner-matching files 0600, symlinks refused). Catalog references are opaque
HMAC identifiers, stable only with retained operator key/namespace. Configured native
ownership and scene/world references are public world data, never MA credentials.
GM control uses the official private MA `/ws` API, with fixed command allowlists,
correlated bounded responses and discarded unsolicited events, behind the preserved
MA target/media/provider checks. The MA account's role still grants broader writes;
filtering is defense in depth, not the sole boundary. No endpoint selector, queue
transfer, grouping, unrestricted HTTP/WS/Sendspin proxy or household discovery is
available to players. No new identity is registered: supplied X25519 SDK identity
must match the already verified DEV target before connecting; reconnecting an existing
known unavailable target never relaxes mutation guards. SDK auth is first-message,
not a token URL. Only original synthetic test sequences may be enabled for playback.
A precise upstream logging limitation: MA 2.10.6's WebSocket handler logs raw frames
at VERBOSE, including auth payloads. No live token WebSocket test was attempted and
no upstream log configuration was read/changed. The GM profile requires explicit
`webSocketAuthLogSafe` operator review of disabled raw-frame logging before use.
The module's own logs omit credentials; it cannot redact MA's logs without changing
that upstream behavior. Do not assume default logging or ignore this gate.
## Browser network/security policy
Private network access from an HTTPS Foundry page still needs permitted routing,
trusted TLS/WSS, CSP and server/browser Origin/local-network policies. Sendspin Noise
does not waive mixed-content restrictions. Current module policy refuses HTTPS ->
non-loopback HTTP/ws MA; modern per-browser local-network exceptions are not a
portable supported deployment. HTTP `/api` CORS is also insufficient in the inspected
pin; GM control instead uses the public authenticated WebSocket API, not a CORS
bypass proxy. No private API is exposed publicly to fix browser access.
No public third-party STUN/TURN is silently used. Default ICE servers are empty;
relay configuration is explicit and TURN credentials must be short-lived. Browser
users necessarily see their own relay credentials and decrypted peer signaling.
Direct P2P can reveal network addresses to the authorized peer; relay-only mode can
reduce that exposure if an approved relay already exists. It cannot guarantee WAN
connectivity without appropriate infrastructure. No service/container is provisioned.
## Signaling and players
Ordinary Foundry module sockets carry only bounded encrypted SDP/control envelopes,
never continuous PCM/audio chunks, MA commands, media URLs, tokens or invitation
secrets. Claimed sender IDs/GM flags are not trusted as authentication. The GM issues
a unique expiring 256-bit per-listener capability out of band over a private
authenticated channel. Possession authorizes that one peer, not a proven login.
A recipient can share its own capability/record received audio; this cannot be
prevented by browser JavaScript. Do not distribute a controller/MA secret as an invite.
AES-GCM covers SDP/ICE/DTLS fingerprints with session/peer/direction/sequence binding,
nonce/expiry, strict fields/types/size limits and asynchronous replay rechecks. A
listener may negotiate one recvonly audio m-line; video, outbound listener audio and
RTC data/control channels are rejected. Keys are per listener, so one recipient
cannot forge another listener's authorized exchange. Invalid broadcast frames are
dropped; world-server/socket flooding is still a server-side availability concern,
not solved by client encryption. Explicit peer/expiry/restart bounds limit our work.
Media uses browser DTLS-SRTP WebRTC audio tracks. No microphone is requested. GM
revocation stops new media, but cannot erase audio already delivered or force a
malicious recipient to discard buffered/recorded content. Real Foundry identity,
packet validation, WAN/NAT and browsers still need live acceptance.
## Authority, failure and original state
Target identity/provider, own active queue, standalone topology and current authority
are rechecked immediately before each mutation. Snapshot and prepared data remain
scoped, generation-checked and serialized. Signed snapshots preserve ordered duplicates,
index/offset/state/repeat for static unshuffled supported queues; expiry, foreign,
tampered or future state denies. Ambiguous remote writes latch closed with no blind
retry. Unsupported shuffle/dynamic/autoplay/overlay/ended/speed states fail closed.
Only the campaign-owned target is eligible; volume/mute state is read before SDK
handover instead of assuming maximum output. Native effects/AmbientSound stay unowned.
The optional companion retains its process-local fenced lease checks. GM-local control
has one-GM checks and a same-origin Web Lock, **not a distributed MA server fence**.
It cannot protect against a malicious/stale independent GM with MA credentials.
Multiple-GM automation/hard fencing remains a readiness blocker. No automatic GM
handover, queue ownership transfer or speaker grouping exists. Foundry disconnect
stops forwarding and future writes; an offline/crashed GM cannot guarantee restoration.
Native fallback never skips reconciliation of an uncertain active MA target.
Existing bounded live harnesses still capture original state and report restoration
success/failure explicitly. No new playback mutation or Sendspin pairing was attempted
in this revision; the read-only check observed an empty idle dedicated queue. The browser measurement
used original synthetic PCM, not real MA or licensed-service content. Existing
synthetic ingestion failure and identity/TLS/logging gates remain. Crossfade,
simultaneous layers, durable recovery and deployment security are not claimed complete.
## Release and supply-chain safeguards
The release builder runs offline, uses no Git credential/remote API and never contacts
the planned Gitea server. It validates public HTTPS URL shape, stable manifest and
versioned ZIP consistency, module ID/author/v14 compatibility, no false `verified`
claim, no mandatory systems/modules, import closure, notices, SDK hash and privacy
patterns. It rejects private/symlinked package files. Exact private token/endpoint/target
scans of history and artifacts supplement these guardrails; they are not a
comprehensive secret scanner or proof of uncontacted server availability.
Official SDK 5.0.0 and noble dependencies are pinned/audited and bundled locally;
there is no runtime CDN or installer. Full Apache/MIT texts accompany releases.
Optional Opus fallback imports are explicitly disabled in the PCM-only SDK build;
libopus/speex/opus-encdec binaries are not distributed. WebRTC's browser codec is not
bundled by this project. Install hooks were disabled. Developer-only Playwright/
esbuild tools and local Chromium are not shipped or a runtime dependency.
CI workflows use pinned action commits on an existing shell runner, build artifacts
for manual publication, and install no services or infrastructure. No Git host was
accessed/authenticated/created/pushed on the user's behalf. Public release files
contain no private MA addresses/credentials/deployment data. A source archive is not
an installable Foundry ZIP; documentation distinguishes both.
Peer signaling also bounds each peer to four queued control frames and 64 received
control attempts per invitation, limiting asynchronous decrypt/SDP backlog. Socket
flooding of the Foundry server remains a server/operator availability concern.