Skip to content

feat!: safe mode by default, trusted replaces untrusted (#323) - #324

Merged
alekswebnet merged 1 commit into
mainfrom
feat/trusted-by-default
Dec 3, 2026
Merged

alekswebnet merged 1 commit into
mainfrom
feat/trusted-by-default

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Part of #323: safe mode by default, the element side. Embed's trust list and the untrusted SCORM zip, decided in #323, come in a second pull request on top of this one.

What changes (player 2.0)

  • Every package plays untrusted unless the page sets trusted: its own library folders ignored, libraries from libraries (default pack), content/ limited to H5P's file types, the content checked against the libraries' semantics. What untrusted did.
  • trusted (attribute and property) plays a package as it is, with its own code. The untrusted attribute and property are gone; setting the attribute asks for the default.
  • A message for the case the new default makes common: an untrusted package that neither the sources nor the package has a library for no longer says to set libraries, which it already has.

Everything that sets trust now

  • Verifier: untrusted by default; --trusted and the option trusted play the package's own code. --untrusted is still taken, so installed skills and older scripts run. The report keeps its untrusted field.
  • VS Code: h5pPreview.trusted, off by default, replaces h5pPreview.untrusted; the preview's Untrusted switch starts on; Restricted Mode stays untrusted.
  • Demo: the player page starts on Untrusted. The app and the cmi5 page play every package untrusted, files and same-site links too, and ask to play one with its own scripts only when it needs them, naming the file or the host. The pages with no setting take the site's own pack (demo/element.js).
  • MCP: the local server's check and preview play untrusted against the installed pack (partsFolder, now exported by h5p-author). The MCP app's play page plays the activity it built untrusted, from the pack copy it builds with.
  • Embed and SCORM, unchanged in behaviour: the embed site sets trusted where it trusts today (its own origin, listed hosts, a third-party frame), and the SCORM launch page sets trusted on the author's package. The second pull request changes both.
  • Docs, the skills and the demo pages lead with safe by default and trusted as the exception.

Breaking, for the release notes

  • A page that relied on the old default plays its packages untrusted: libraries from the pack (jsDelivr unless pack-base or pack), and a package that needs a library the pack lacks is refused with carried until the page sets trusted.
  • On such a page a package's revision changes, since it names the pack parts the package now plays against. Statements carry the new one. With resume="device" a learner's saved state starts over once: one saved against another revision is dropped, and the runtime says the content has changed. A resume="host" page that keys its saved state by revision sees the same.
  • player.untrusted = false no longer trusts a package.
  • h5p-verify plays untrusted unless --trusted.
  • VS Code: h5pPreview.untrusted is no longer read; h5pPreview.trusted plays with the package's own code.
  • Before the release: publish @missing-elements/h5p-libraries 1.1.2, which main names and every untrusted load now fetches.

Tests

  • Player 629 (the fixtures play trusted through the helper, since their content type is in no pack; untrusted plays say so), embed 83, verify 33, VS Code 30 and its suite in a real VS Code (8), demo 24 with two new cases (a same-site link plays untrusted; a file that needs its own code asks, naming it), author 335, MCP 24, MCP app 33, cmi5 50, journeys 56, skills 84. Typecheck and comments pass.

Release: player, verify and the VS Code extension major or breaking; the packages that pin the player follow at the bump.


Summary by cubic

Safe mode is now the default: every package plays untrusted — none of its own code runs, its libraries come only from the libraries sources (the pack by default), and its content is checked against the libraries' semantics — unless the page sets trusted. The untrusted attribute and property are gone; setting one asks for the default.

Breaking changes

  • A page that relied on the old default now plays its packages untrusted: a package that needs a library the pack lacks is refused with carried until the page sets trusted.
  • player.untrusted = false no longer trusts a package.
  • h5p-verify plays untrusted unless --trusted; --untrusted is still accepted and does nothing.
  • VS Code reads h5pPreview.trusted instead of h5pPreview.untrusted.
  • Before releasing, publish @missing-elements/h5p-libraries 1.1.2, which main names and every untrusted load now fetches.

What it touches

  • The verifier, the VS Code extension, the demo app, the cmi5 page, and the MCP server and app all default to untrusted; Embed and the SCORM page set trusted where they already trusted, so their behaviour is unchanged.
  • Docs, skills and the demo lead with safe by default and trusted as the exception.

Written for commit 8223fd3. Summary will update on new commits.

View guided diff Turn on auto-fix

Every package plays untrusted unless the page sets trusted. The verifier plays untrusted
unless --trusted (--untrusted still taken); VS Code reads h5pPreview.trusted; the demo app
and cmi5 page play every package untrusted and ask when one needs its own code; the MCP
server and app play untrusted from their own pack copy. Embed and the SCORM page set
trusted where they trust today. Docs, skills and the demo lead with safe by default.
@alekswebnet
alekswebnet force-pushed the feat/trusted-by-default branch from dc5e10a to 8223fd3 Compare December 3, 2026 06:36
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d4085e2 and 8223fd3.

Files selected for processing: 79

  • AGENTS.md
  • README.md
  • SECURITY.md
  • apps/demo/app/app.js
  • apps/demo/app/index.html
  • apps/demo/demo/cmi5-page.js
  • apps/demo/demo/cmi5.html
  • apps/demo/demo/compare.html
  • apps/demo/demo/element.js
  • apps/demo/demo/player-page.js
  • apps/demo/demo/setup.html
  • apps/demo/index.html
  • apps/demo/scripts/sweep-content-types.mjs
  • apps/demo/tests/app.test.ts
  • apps/skills/tests/author-playback.test.ts
  • apps/skills/tests/author-verify.test.ts
  • design/author.md
  • design/demo.md
  • design/element.md
  • design/libraries.md
  • design/licensing.md
  • design/security.md
  • design/verify.md
  • design/vscode.md
  • docs/api.md
  • docs/compatibility.md
  • docs/frame-csp.md
  • docs/libraries.md
  • docs/privacy.md
  • docs/resume.md
  • docs/setup.md
  • docs/troubleshooting.md
  • docs/untrusted.md
  • docs/verify.md
  • packages/author/lib/author.mjs
  • packages/author/lib/node.mjs
  • packages/author/vitest.config.ts
  • packages/embed/README.md
  • packages/embed/lib/scorm-core.mjs
  • packages/embed/site/embed.js
  • packages/embed/tests/scorm.test.ts
  • packages/embed/tests/site.test.ts
  • packages/libraries/README.md
  • packages/mcp-app/play/play-page.ts
  • packages/mcp/README.md
  • packages/mcp/lib/server.mjs
  • packages/player/README.md
  • packages/player/src/h5p-offline-player.ts
  • packages/player/src/sw/mount.ts
  • packages/player/src/sw/package-reader.ts
  • packages/player/tests/browser/framed/player.html
  • packages/player/tests/browser/pack.test.ts
  • packages/player/tests/browser/playback.test.ts
  • packages/player/tests/browser/recovery.test.ts
  • packages/player/tests/browser/several-players.test.ts
  • packages/player/tests/browser/untrusted.test.ts
  • packages/player/tests/browser/utils.ts
  • packages/player/tests/unit/libraries.test.ts
  • packages/runtime/NOTICE.md
  • packages/runtime/README.md
  • packages/verify/README.md
  • packages/verify/bin/h5p-verify.mjs
  • packages/verify/lib/page.html
  • packages/verify/lib/preview.html
  • packages/verify/lib/preview.mjs
  • packages/verify/lib/verify.mjs
  • packages/verify/tests/package-types.ts
  • packages/verify/tests/preview.test.ts
  • packages/verify/tests/verify.test.ts
  • packages/vscode/README.md
  • packages/vscode/package.json
  • packages/vscode/src/page.mjs
  • packages/vscode/src/previews.mjs
  • packages/vscode/tests/html.test.ts
  • packages/vscode/tests/vscode/suite.cjs
  • skills/h5p-author/references/build/built-here.md
  • skills/h5p-player-setup/SKILL.md
  • skills/h5p-player-setup/references/troubleshooting.md
  • skills/h5p-verify/SKILL.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@alekswebnet
alekswebnet merged commit 5aa287e into main Dec 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant