fix: bound recording resources and add security regressions (#41)
Build and WordPress integration / Build and publish pristine package (push) Canceled after 0s
Build and WordPress integration / PHP 8.3 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / PHP 7.4 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / WordPress 6.3 / PHP 7.4 (push) Canceled after 0s
Build and WordPress integration / WordPress latest / PHP 8.2 (push) Canceled after 0s
Build and WordPress integration / Plugin Check (advisory) (push) Canceled after 0s

- Bound recording bytes, JSON structure, events, markers, terminal dimensions
  and timestamp arithmetic before unsafe player allocation or scheduling.
- Share validated playback data and metadata; cancel stale, failed and timed-out loads.
- Add PHP 7.4-compatible predecode budgets and preserve supported v1/v2/v3 behavior.
- Add localized errors, documented limits and 110 official/seeded recording fixtures.

Verified 325 Node tests, native PHP 7.4/8.3 regression suites and 55 Chromium tests
on each WordPress CI matrix. Preserve plugin version, vendor files and isolated
package artifacts.
This commit is contained in:
2026-10-15 11:42:07 +08:00
committed by GitHub
parent ffff9704e5
commit 6f8182db41
113 changed files with 7121 additions and 126 deletions
+25 -8
View File
@@ -85,19 +85,36 @@ permission. Multisite networks must also allow the `cast` extension. The plugin
does not grant extra upload permissions or add a separate recording-management
post type.
Uploads are checked against these limits:
Uploads and browser playback (including remote recordings) enforce these resource limits:
- **32 MiB** per file.
- **100,000** events or stream lines.
- **256 KiB** per JSONL line.
- **1,000** columns or rows in either direction.
- **32 MiB** of received recording data; **2 MiB** for legacy v1.
- **100,000** events or stream lines, including ignored lines.
- **256 KiB** per JSONL line and **1,000** marker events.
- **1,000** columns or rows per axis, and **40,000** terminal cells (columns × rows).
- **2,147,483,647 milliseconds** (about **24.85 days**) for recording timelines and supported time values. Relative v1/v3 intervals are accumulated in milliseconds, matching the player. Browser playback also requires cumulative recording time divided by playback speed to fit this ceiling; at **0.01×**, this permits about **5.97 hours** of source time. This conservative bound keeps native timer delays and output batching within their supported numeric range. Playback start, idle-time and timestamp-poster options are checked too.
- At most **15** nested JSON containers, **400,000** scalar/key tokens and **100,016** containers in v1, or **20,000** scalar/key tokens per JSONL line, checked before decoding. Unknown metadata and duplicate keys count too.
- Browser requests stop after **30 seconds** total or **10 seconds** without the next response/chunk; the editor also allows 30 seconds for player assets and loading together.
The older asciicast v1 format is limited to **2 MiB**. Its JSON must be
pretty-printed, with the opening `{` on a line of its own; the bundled player
cannot read compact, single-line v1 files. Asciicast v2 and v3 use standard JSONL.
The cell budget covers initial dimensions and every resize, including effective
Columns/Rows overrides. Overrides are also checked against the player's initial
80×24 defaults before creating its terminal, so a single-axis override must fit
both the initial terminal and the recording. A zero header dimension uses the player's default;
ordinary blank/comment lines and safe unknown event types remain compatible.
Asciicast v2 and v3 use JSONL; legacy v1 remains supported within its smaller limit.
Lower site or server upload limits still apply. Invalid recordings are rejected;
this does not enable general JSON, HTML or SVG uploads.
These limits also apply to older or externally hosted recordings at playback.
Very large terminals or marker-heavy recordings that previously loaded may now
show a clear limit error. Split or simplify those recordings rather than relying
on the browser to handle unlimited data. Existing files and posts are not rewritten.
The browser reads and validates a single recording request before handing it to
the player. There is no server proxy or additional metadata request. A timed-out
or canceled load is stopped; switching recordings and leaving a preview cancel
its old request. Remote hosts must still allow CORS, and browser credentials and
referrer rules are unchanged.
## Languages
The plugin's interface includes English and Simplified Chinese (`zh_CN`).