Skip to content
Back to skills

Nyxs Page Scripts

ASecurity

How code that runs inside a webview's own page (not the app's) is bundled and kept apart from the app in Nyxs. Use when adding or changing a `?page-script` import, code that must run in a hidden or preview webview (like the YouTube Music engine), or an eval / new Function that the security tests flag.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 6, 2026
ai-agentsrustgoreactapisecurity

Works with

  • api

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add nyxs-code/nyxs-code --skill nyxs-page-scripts --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nyxs Page Scripts?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nyxs Page Scripts
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nyxs-code-nyxs-page-scripts/badge)](https://www.skillsdirectory.com/skills/nyxs-code-nyxs-page-scripts)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nyxs-page-scripts
description: How code that runs inside a webview's own page (not the app's) is bundled and kept apart from the app in Nyxs. Use when adding or changing a `?page-script` import, code that must run in a hidden or preview webview (like the YouTube Music engine), or an eval / new Function that the security tests flag.
---

# Page scripts

Some code must run inside a web page Nyxs opens in a webview (the YouTube Music engine on
YouTube's origin, `src/lib/music/youtubeEngine/page.ts`), not in the app's own page.

## How it is bundled

`import code from "./page.ts?page-script"` (plugin `pageScriptPlugin` in `vite.config.ts`):
rolldown bundles the file and its imports into one IIFE string, `keepNames` on (youtubei.js looks
its parser classes up by name). Nyxs then runs that string in the webview. The type is declared
in `src/vite-env.d.ts`.

## The security boundary

The app's real boundary is that no foreign code runs in its own webview: any script there can
call Rust. So `src/lib/__tests__/securityBoundary.test.ts` forbids `eval(` and `new Function(` in
`src/`, with one list of exceptions, `PAGE_SCRIPTS`:

- A file goes there only if it runs **only** in a webview's page. Write why next to it.
- The test "loads the page scripts only into a webview's page" resolves every import in `src/`
  and fails if a listed file is imported anywhere without `?page-script`. Never import a page
  script normally, not even its types from the app (move shared types to another file, as
  `protocol.ts`).

## Talking to it

The page script puts its API on a global of the page (`ENGINE_GLOBAL`) and the app calls it
through the webview; the shapes both sides use live in `youtubeEngine/protocol.ts`, which has
only types and constants, so the app can import it. The page script imports only libraries and
its own folder (`./parse`, `./protocol`), never `@/lib/...` modules that touch Tauri, React or the
app's stores.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.