Files
adaptive-music/evidence/UPSTREAM.md
T

127 lines
8.3 KiB
Markdown
Raw Normal View History

2026-12-03 16:11:47 -05:00
# Upstream source audit
Inspected 2026-12-03 using GitHub release metadata, shallow tagged Git checkouts and
PyPI source distribution. Full commits and selected file SHA-256 values are in
[upstream.json](upstream.json). Checkouts are ignored under .local/upstream; no
install hooks or upstream application code executed. Hashes establish reproducibility,
not signature verification or a security audit. Release selection excludes drafts
and prereleases; package version placeholders are not reliable release identifiers.
| Component | Inspected release | Role | License |
| --- | --- | --- | --- |
| Sayshal/vgmusic | release-1.4.5 | Latest stable observed; behavioral reference | MIT |
| music-assistant/server | 2.10.6 | Deployment target source | Apache-2.0 |
| music-assistant/frontend | 2.17.297 | Exact server dependency | Apache-2.0 |
| sendspin/sendspin-js | 5.0.0 | Exact pinned frontend dependency | Apache-2.0 |
| sendspin/sendspin-js | 6.1.0 | Latest stable observed; comparison only | Apache-2.0 |
| aiosendspin | 9.1.1 | Exact server Sendspin dependency; PyPI sdist | Apache-2.0 |
Latest frontend release observed was 2.17.388 at commit
e19509049634795d69abd4dec417f1281201deb8, pinning Sendspin JS 6.1.0. It was inspected
for comparison before checking out the server-pinned frontend. Latest MA stable
observed was 2.10.15. Neither is a recommendation to upgrade production.
## VGM findings
[Release source](https://github.com/Sayshal/vgmusic/tree/eba07a08c9925f31b9c8adb72faf95de11ae705c)
contains module.json declaring Foundry minimum/verified 14 and **requires 3ds-atlas**.
`package.json` has no runtime npm dependencies; development dependencies include
Rollup, Terser, ESLint/JSDoc, Prettier, Stylelint, lint-staged, copy and PostCSS
plugins. Its package-lock has 396 non-root package entries. At the initial source audit, no npm vulnerability
scan or install was run because Node/npm were absent. The later prototype uses no
third-party packages and has not installed or audited VGM development dependencies. This is an inventory, not a
finding that dependencies are safe. Manifest version/download are build placeholders
and package.json says 1.0.0; GitHub stable release tag is the version evidence.
`scripts/music-controller.mjs` uses ATLAS primary-GM arbitration/logging, resolves
scene/combat/token/actor contexts, pauses/restores track offsets via document flags,
and stops per-playlist sounds to avoid reseeding shuffle. `scripts/hooks.mjs` listens
to core combat, scene, token and actor hooks; other source includes optional
Calendaria and Minstrel interaction. These integrations are not required by this
project. Snapshot concept is useful, but no MA provider, secure gateway, campaign
isolation or demonstrated full queue restoration was found. MIT permits reuse with
the copyright and permission notice; see THIRD-PARTY-NOTICES.
## Music Assistant API findings (2.10.6 source)
All paths below are within
[the pinned server](https://github.com/music-assistant/server/tree/c24866405bd2068c25a60e1014e5ef8c3f6445bb).
- `music_assistant/controllers/webserver/controller.py`: GET `/info`, GET `/ws`,
POST `/api`, generated `/api-docs/commands.json`, schemas and OpenAPI routes.
Source identifies these routes; only `/` and `/info` were probed live: initially timed out, now both HTTP 200
with `/info` reporting 2.10.6. No authenticated API command has been sent.
- `websocket_client.py`: server info on connect, command envelopes parsed as
CommandMessage (`message_id`, `command`, `args` as used by frontend), special
`auth` command with token; authenticated event subscriptions. Not a generic
arbitrary JSON-RPC-over-WebSocket assumption. HTTP API has separate JSON-RPC handler.
- `auth.py` and `helpers/auth_middleware.py`: built-in credential and token paths,
`auth/login`, `auth/token/create`, `auth/token/revoke`, scopes, player/provider
filters and Bearer-header support. No credentials used, account created or token
minted. Effective least-privilege scopes must be checked in an authorized test.
- `player_queues/controller.py`: `all/get/items` (items default limit 500 and offset),
`play_media`, `play_index`, `seek`, `pause/resume`, `shuffle/repeat`, `transfer`.
`play_media` accepts queue_id, media, option, start_item and shuffle among others.
Seek rejects no-duration or out-of-range media. Queue read/control scopes are
declared, but do not assume all handlers enforce identical resource filters.
`_check_player_permission` permits an own-client exception and tests a *nonempty*
player filter; empty filters are not restrictive. Gateway must independently
validate all resources, methods, arguments and returned metadata.
- No public atomic full queue snapshot/restore pair found in the inspected controller.
Rebuilding requires ordered items, duplicate occurrence/index, position, mode and
state; shuffled future order and dynamic playlists remain PoC questions.
- `providers/sendspin/manifest.json`: builtin beta-stage provider;
`aiosendspin[server]==9.1.1`, `av==16.1.0`. Server pyproject requires Python >=3.14
and frontend==2.17.297; sandbox Python 3.12 cannot run this MA server version.
## Sendspin findings
[Pinned frontend](https://github.com/music-assistant/frontend/tree/e779b9d359e47cd210c2801f16a0ce6263571903)
`package.json` pins Sendspin JS **5.0.0**. `src/plugins/sendspin-connection.ts` wraps
WebSocket authentication `{type:"auth", token, client_id}` and provides alternate
remote DataChannel handling. We will not enable MA remote mode.
MA `controllers/webserver/sendspin_proxy.py` authenticates the first message then
forwards bidirectionally, optionally registering the chosen client ID with that
session. Authentication is not demonstrated campaign-level authorization. No claim
that forwarding this socket safely restricts listeners is justified.
[Sendspin JS 5.0.0 source](https://github.com/Sendspin/sendspin-js/tree/7d103075138dda5c8909045647bb42b33c2d44fc)
uses Noise transport and advertises `player@v1`, `controller@v1`, `metadata@v1` in
`src/core/protocol-handler.ts`. Codec type includes PCM, FLAC and Opus; browser code
uses AudioContext/WebCodecs and an opus-encdec fallback. Comments identify Firefox
Opus limitations; those are upstream claims, not tested here. Both inspected JS
versions depend on @noble/ciphers, @noble/curves, @noble/hashes and opus-encdec.
5.0.0 and 6.1.0 package version fields are 0.1.0 build placeholders. Both require
Node >=20.19.0. Pin release tags/commits and verify published package before adoption.
aiosendspin 9.1.1 sdist SHA-256 matches PyPI metadata. It requires Python >=3.12 and
has client/server implementations with protocol version 1, Noise, legacy transport
handling, pairing and role machinery. Runtime dependencies: aiohttp, cpace,
cryptography, mashumaro, noiseprotocol, orjson, zeroconf; optional server adds av,
numpy and pillow. Source was extracted safely and inspected, not installed or run.
It is a plausible gateway-worker candidate, not a verified compatible solution.
All transitive licenses (especially bundled codec/WASM assets), distribution NOTICE
files and vulnerability results must be reviewed before packaging dependencies.
No runtime dependency has been adopted by Adaptive Music at this milestone.
## Foundry public API evidence
Official [v14 Playlist API](https://foundryvtt.com/api/classes/foundry.documents.Playlist.html)
and [PlaylistSound API](https://foundryvtt.com/api/classes/foundry.documents.PlaylistSound.html)
were inspected. Public Playlist playback and document update APIs are the native
adapter boundary. A v14 API reference and VGM's v14 manifest do not verify behavior
on build 14.371. No Foundry binaries or proprietary source were obtained.
## Implementation follow-through — 2026-12-03
Selected pins and hashes still pass `verify_upstream.py`. The native prototype
adapts the VGM per-sound update/pausedTime pattern with its 2025 3 Death Saves MIT
notice. Core policy and local GM/settings/hooks are new code; ATLAS and optional
integrations were not copied. No upstream runtime dependency was installed.
The official v14 Playlist/PlaylistSound public API pages were rechecked; they remain
API references, not build 14.371 playback evidence. Native document tests are mocks.
MA PoC uses the source-inspected HTTP envelope (raw response, not a JSON-RPC result
wrapper). Account-role/token limitations are recorded in gateway/README.md.