A board takes Flash when its files say swf or flv (bbs chan board set f
files swf,flv), as 4chan's /f/ did, and [chan] ruffle names Ruffle's
self-hosted package (make ruffle fetches it from npm into ruffle/).
- SWF: FWS and CWS read for the stage, frames, rate and sounds, the
tags walked as they unpack with nothing kept (a zlib bomb costs no
memory and is refused); ZWS (LZMA) taken as 550x400 with sound
- FLV: onMetaData (AMF0) for size and length, the tags for sound and
the video codec (Sorenson, Screen, VP6, VP6 alpha, H.264); ffmpeg
thumbnails it, a movie gets a card
- sound needs the board's sound; an FLV is held to max_video
Clicking a Flash thumbnail plays it in a sandboxed frame (/chan/flash:
allow-scripts alone, by its CSP and the frame's attribute): no origin,
no cookies, nothing of the page. The page fetches the file with its own
cookies and hands the bytes over; Ruffle runs with networking, scripting
and links off. Ruffle 0.7.1 does not play a standalone FLV, so the BBS
makes a small AVM1 movie of its own (/chan/flvplayer.swf: NetStream
into a Video of the FLV's size) that plays it from a blob of the frame.
Ruffle's files are served at /chan/ruffle/ with CORS open (the frame
has no origin), only the package's .js, .wasm and .map.
Played in Chromium with Ruffle 0.7.1: a movie, and a Sorenson FLV with
sound through the player; both frames of origin "null", cookies
refused, no CSP violations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
A board takes files besides images when its file types say so (bbs chan
board set DIR files webm,mp4,pdf; sound yes), as 4chan's take WebM and
/po/ PDFs. Each file is known by its bytes and read before it is kept:
- WebM: its EBML walked for the doc type (webm, not any Matroska), the
tracks' codecs (VP8, VP9, AV1; Vorbis, Opus), size and length
- MP4: its boxes walked for the movie header and tracks (H.264, AV1,
VP9; AAC, Opus); HEVC and the like refused, as browsers do not all
play them
- PDF: whole (%PDF- to %%EOF), its pages counted and first page's size
found where its objects are not compressed
Videos are at most 4096 pixels a side and [chan] max_video seconds long
(120; one that does not say is refused while there is a limit), and
silent unless the board takes sound. Thumbnails come from [chan]
ffmpeg (the first frame, the container named to it) and pdftoppm (the
first page), else a card saying what the file is.
In the page a video's thumbnail plays it in place with [Close]; a PDF's
opens it in a tab, served without the boards' CSP (a viewer will not
run under it) and nosniff. The post form lists what the board takes;
posts say a video's length, a PDF's pages; the JSON has 4chan's
webm_audio and max_webm_duration, and duration_ms, page_count,
file_types. Terminals show their thumbnails.
Fuzzing the readers found an EBML element head read past its parent
(a panic); fixed, the input kept as a regression case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr