From f8e9fb487541700f80d248070e581c907dd4e263 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Sun, 18 Oct 2026 02:07:15 +0300 Subject: [PATCH 1/3] feat(verify): check a package the way a site plays it untrusted --untrusted plays the package with the element's untrusted, as a site that did not make it does: none of its own code runs, the libraries come only from the pack, and the content is checked against their semantics. What the check removed is measured from the frame, the package's content.json against the parameters the runtime was handed, and reported as warnings by field: markup, attributes and styles by name, fields, list items, values. The runtime's own notes are kept beside them. A package that needs its own copy of a library is refused, and the summary says what to do. --libraries takes a bundle on disk too, served by the verifier itself, so the check runs offline against a pack the caller names. Closes #38 Co-Authored-By: Claude Opus 5.5 --- docs/untrusted.md | 3 +- docs/verify.md | 4 +- packages/verify/README.md | 29 +++- packages/verify/bin/h5p-verify.mjs | 11 +- packages/verify/lib/page.html | 5 +- packages/verify/lib/verify.mjs | 194 +++++++++++++++++++++++++-- packages/verify/tests/verify.test.ts | 97 +++++++++++++- skills/h5p-verify/SKILL.md | 26 ++-- 8 files changed, 341 insertions(+), 28 deletions(-) diff --git a/docs/untrusted.md b/docs/untrusted.md index 2078c734..2060e1b9 100644 --- a/docs/untrusted.md +++ b/docs/untrusted.md @@ -116,4 +116,5 @@ With or without `untrusted`: there. For a site with signed-in users, [Embed](https://github.com/missing-elements/h5p-offline-player#embed) puts the player on a separate domain as well. - **Correctness.** The check is about safety. Whether a package works at all is what - [`h5p-verify`](verify.md) answers. + [`h5p-verify`](verify.md) answers; `h5p-verify --untrusted` plays it the way your site will, and + lists what the check removes from it. diff --git a/docs/verify.md b/docs/verify.md index 57de089a..3c8cb191 100644 --- a/docs/verify.md +++ b/docs/verify.md @@ -8,6 +8,8 @@ npx @missing-elements/h5p-verify course.h5p # exit 0: it plays; 1: it doe ``` It names missing libraries, fails on an uncaught error while the runtime boots, and checks that -the content drew something. It is meant as the last step of a pipeline that generates or +the content drew something. With `--untrusted` it plays the package as a site that did not make +it will, [untrusted](untrusted.md), against the library pack, and lists as warnings what the +content check removes from each field: markup, attributes and styles by name, fields, values. It is meant as the last step of a pipeline that generates or rewrites packages; the skill in `skills/h5p-verify/` tells an agent when to run it and how to read the result. diff --git a/packages/verify/README.md b/packages/verify/README.md index e34e994b..38762296 100644 --- a/packages/verify/README.md +++ b/packages/verify/README.md @@ -27,11 +27,36 @@ reaches `ready`, that nothing throws while booting (an error after `ready` is a content drew something, and it lists failed requests, CSP blocks and the build's `revision`. It does not judge correctness, suitability, accessibility or licensing: look at the screenshot. +## Played untrusted + +A site that plays packages it did not make plays them +[`untrusted`](https://github.com/missing-elements/h5p-offline-player/blob/main/docs/untrusted.md), +as the H5P plugins treat an upload: none of the package's own code runs, its libraries come only +from the site's pack, and its content is checked against each library's `semantics.json`. +`--untrusted` plays it that way: + +```bash +npx @missing-elements/h5p-verify course.h5p --untrusted +``` + +``` +pass course.h5p ready in 0.83 s revision sha256:c4fd49473b30cd97… + warning: content check: content[2].content.params.text: markup removed:
,