Repository navigation
feat(mabr-route-proxy): discover ROUTE manifests from public DS SLS - #27
Conversation
There was a problem hiding this comment.
Ally — Consolidated PR Review
Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex (applied directly; nested CLI not launched in the k8s runtime).
Reviewed head: d8cb72e
Looks good. SvcInetUrl discovery is origin-pinned and https-only, /slt/ group parsing no longer trusts arbitrary hrefs (same-origin, numeric, no query/hash), and the Shaka Fetch-plugin patch only replaces a snapshot that is identical to the page's fetch and restores it only if still ours.
Critical Issues (0)
Important Issues (0)
Suggestions (3)
- [native-codex]
packages/mabr-route-proxy/src/route.ts(discoverSlsEndpoint, sltUrl/dsUrl origin check) —new URL(sltRaw)/new URL(dsRaw)are parsed without thelocation.hrefbase used two lines later, so a relativesltUrl(still accepted when given alone) throws a bareTypeError: Invalid URLoncedsUrlis also set.- Resolve both against the same base before comparing origins.
- [pr-review-toolkit:code]
packages/mabr-route-proxy/src/route.ts(uniquededupe) — the dedupe key issource/group/portonly, so if two SLT groups advertise the same SLS leg with differentSvcInetUrls, the returnedmanifestUrlis whichever document resolved last, silently.- Either include
manifestUrlin the key (so the ambiguity surfaces as the existing "select exactly one" error) or prefer the entry that carries a manifest.
- Either include
- [gstack/review]
packages/mabr-route-proxy/src/route.ts(advertisedManifestUrl) — thehttps:requirement means an http DS origin (dev/test, e.g. the127.0.0.1e2e server) always yieldsmanifestUrl: undefinedwith no hint why; the README example then throws "did not advertise". Worth one sentence in the README or a debug warning.
Strengths
- Cross-origin
SvcInetUrlrejection is tested, and a malformed optional URL cannot hide a valid SLS leg. - Test fixtures drop the production DS hostname and real source IP in favour of
ds.example.test/192.0.2.10. - e2e now exercises both the debug and the production compiled Shaka builds when present.
Recommended Action
- No blocking changes requested.
- Merge once the remaining required CI checks finish green.
d8cb72e to
a6a882a
Compare
There was a problem hiding this comment.
Ally — Consolidated PR Review
Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Nested CLIs not launched in the k8s Job pod; lens prompts applied directly to the diff.
Reviewed head: a6a882a
The prior Ally review (d8cb72e) carried no Critical/Important findings, so there is no prior-finding ledger for this head. This head is a rebase over #26 plus the DS-discovery change.
Critical Issues (0)
Important Issues (1)
- [pr-review-toolkit:code / native-codex]
packages/mabr-route-proxy/README.md:35(and:69) — the documented integration loads a manifest URL that is outside the proxy's cache scope, so no ROUTE object can ever be served.- The example sets
baseUrl = 'https://player.example/mabr/'(line 14) and then callsshakaPlayer.load(toSls.manifestUrl).advertisedManifestUrl(src/route.ts:224) only ever returns a URL on the DS origin (https://live.example/live/manifest.mpd).RouteProxykeys every cached object asnew URL(contentLocation, baseUrl)and refuses anything outsidenew URL('.', baseUrl)(src/proxy.ts:90-101, lookup at:147). So the manifest and every segment it references resolve underlive.example, never underplayer.example/mabr/— every request misses and goes to unicast. Playback works, which is what makes it dangerous: the multicast path silently does nothing and nothing reports it. - Nothing in the code reconciles the two either:
manifestUrlis returned onRouteEndpointbutRouteMabrSessionnever compares it withbaseUrl. - Fix one of: (a) document/derive the relationship — the ROUTE
Content-Locationmust resolve, againstbaseUrl, to the same URL asSvcInetUrl, and the example'sbaseUrlmust be chosen accordingly (notebaseUrlmay not be the origin root per the scope rule, which constrains where the DS can publishSvcInetUrl); or (b) have the session reject/warn when anslsEndpoint.manifestUrlis not under the cache scope, so the misconfiguration is loud. A test that loads the discoveredmanifestUrlthroughproxy.fetchand asserts a cache hit would pin it.
- The example sets
Suggestions (3)
- [gstack/review]
packages/mabr-route-proxy/src/route.ts:284— the same-origin check usesnew URL(sltRaw)/new URL(dsRaw)without a base, while the next line resolves againstglobalThis.location. A relativesltUrl(otherwise supported) plusdsUrlthrows aTypeError: Invalid URLinstead of the intendedRangeError. Resolve both against the same base before comparing. - [pr-review-toolkit:errors]
packages/mabr-route-proxy/src/route.ts:216,224—SvcInetUrlis accepted only with an.mpd/.m3u8suffix and only overhttps:. Extensionless manifest endpoints andhttp:DS origins (local/staging) silently yieldmanifestUrl: undefined, which callers will read as "DS advertised nothing". Consider a short comment documenting both filters, or surfacing why a candidate was dropped. - [pr-review-toolkit:code]
packages/mabr-route-proxy/README.md:67— the second example passessltUrlto the session and callsdiscoverSlsEndpointseparately, so the SLT listing and group documents are fetched twice. CalldiscoverSlsEndpointonce and passslsEndpoint: sls, as the first example does.
Strengths
sltGroupsreplaces the bare-digithrefregex with origin- and path-scoped URL resolution, so a listing can no longer steer discovery to another origin, and trailing-slash group links (7/) now work.SvcInetUrlis constrained to the DS's own HTTPS origin, with a test (does not return a cross-origin SvcInetUrl) covering the redirect case; a malformed URL does not hide a valid SLS leg.- Test fixtures dropped real production hostnames/IPs for
example.test/ RFC 5737 addresses.
Recommended Action
- Address Important issues this cycle.
- Consider Suggestions opportunistically.
|
@ally please review exact head |
There was a problem hiding this comment.
Ally — Consolidated PR Review
Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Nested CLIs not launched in the k8s Job pod; lens prompts applied directly to the diff.
Reviewed head: cf5677b
Looks good. The one new commit (fix(mabr): validate DS manifest cache scope) closes the prior Important finding and also picks up all three prior suggestions.
Prior Findings Dispositioned (1)
- prior:a6a882a important 1 — fixed —
packages/mabr-route-proxy/src/route.ts:827and:916-926—start()now runs#assertManifestScopeon every endpoint (discovered or passed asslsEndpoint) before any subscribe. It uses the same scope rule asRouteProxy(new URL('.', baseUrl)+startsWith,src/proxy.ts:91,101), so an out-of-scopemanifestUrlnow throws aRangeErrorthat names both URLs. The README derivesbaseUrlfromnew URL('.', manifestUrl)(README.md:19,:63). The testfails loudly when the discovered manifest is outside the cache scopepins it, and its gateway throws onsubscribeto prove the check runs first.
Critical Issues (0)
Important Issues (0)
Suggestions (1)
- [pr-review-toolkit:code]
packages/mabr-route-proxy/src/route.ts:317-320— the dedupe key now includesmanifestUrl. Two SLT groups advertising the same SLS leg, one with aSvcInetUrland one without, now count as 2 endpoints and throw "select exactly one". That is stricter than needed in the benign case. If that topology can happen, prefer the entry that carries a manifest before counting. Otherwise ignore this.
Strengths
- Relative
sltUrl/dsUrlare resolved against one page base before the origin comparison, with a test (resolves relative discovery URLs before comparing their origins). - Conflicting manifests for one leg now come up as an error, not last-write-wins, and there is a test for it.
PresentationManifest(Blockcast SLT extension) shares the existing https/same-origin guard, so the new element cannot steer the page off the DS origin.- The README's second example now fetches discovery once (
slsEndpoint: sls) and documents that HTTP discovery yields nomanifestUrl.
Recommended Action
- No blocking changes requested.
- Merge once the remaining required CI checks finish green.
Make browser ROUTE bootstrap use the public delivery-service authority instead of deployment-owned presentation metadata. The library discovers
/slt/and the selected SLS service, reads its TO-generatedSvcInetUrlfor DASH or HLS, and keeps AMT/native DIMT and per-rendition S-TSID discovery in the browser.The parser rejects cross-origin manifest URLs and does not expose fixed multicast groups or DS-specific paths. Tests cover generic DASH, HLS, DS-origin discovery, malformed/cross-origin URLs, AMT, native DIMT, and browser RaptorQ recovery.
Validation:
npm test -- --test-reporter=spec; 38 tests passed.