strawcore/src/youtube
Sulkta 0c75d64707 Cap attribution_link recursion + Downloader response body size
Two adversarial bugs surfaced by the round-2 audit on this crate.

extract_video_id recursion (linkhandler/stream.rs)
  /attribution_link?u=<inner> recursed on the inner URL with no depth
  guard. The comment claimed 'only one level deep' but the call was
  plain recursion — a pasted URL whose u= param decodes to another
  /attribution_link would recurse until the JVM stack blew. Wrap the
  recursion in extract_video_id_inner with an explicit depth counter
  capped at MAX_ATTRIBUTION_DEPTH = 1.

ReqwestDownloader body cap (downloader/default_impl.rs)
  resp.text() read the entire response body into a String with no
  upper bound. Player.js is ~1.5 MB, watch HTML ~3 MB, channel
  responses well under 1 MB. A hostile redirect target (or compromised
  host) could blast multi-GB and OOM-kill the Android process — there
  is no headroom on a 1 GB JVM heap ceiling.

  Cap at 32 MB. Two-stage check: bail fast on a known Content-Length
  that exceeds the cap, and use Read::take(MAX+1) on the stream so we
  detect overrun rather than silently truncate. Switched the final
  decode to from_utf8_lossy so a single mojibake byte doesn't drop the
  whole response (same fix shape as the wrapper's read_capped_body).
2026-05-26 22:02:40 -07:00
..
js Phase 2 — JS deobfuscator (rquickjs + ress) 2026-05-24 16:53:19 -07:00
linkhandler Cap attribution_link recursion + Downloader response body size 2026-05-26 22:02:40 -07:00
potoken Phase 5 — PoTokenProvider trait + stream_extractor wiring 2026-05-24 17:10:13 -07:00
channel.rs channel: extract avatar from pageHeaderRenderer + metadata fallback 2026-05-25 19:47:46 +00:00
client_request.rs Phase 3 — InnerTube + itag 2026-05-24 16:57:47 -07:00
constants.rs Phase 3 — InnerTube + itag 2026-05-24 16:57:47 -07:00
itag.rs Phase 3 — InnerTube + itag 2026-05-24 16:57:47 -07:00
mod.rs Phase 6 — Search + Channel + Playlist + LinkHandler 2026-05-24 17:16:14 -07:00
parsing.rs Phase 4 (partial) — stream value types + InnerTube /player helpers 2026-05-24 17:01:03 -07:00
playlist_extractor.rs Phase 6 — Search + Channel + Playlist + LinkHandler 2026-05-24 17:16:14 -07:00
search_extractor.rs Phase 6 — Search + Channel + Playlist + LinkHandler 2026-05-24 17:16:14 -07:00
stream_extractor.rs Phase 5 — PoTokenProvider trait + stream_extractor wiring 2026-05-24 17:10:13 -07:00
stream_helper.rs Phase 4 (complete) — stream_extractor orchestrator 2026-05-24 17:08:04 -07:00
suggestion_extractor.rs Phase 6 — Search + Channel + Playlist + LinkHandler 2026-05-24 17:16:14 -07:00