wisewigdocs

Security validation

Beta security validation runs at three layers. pnpm test is the single required entry point and fails if any layer fails.

Contract and regression tests

Vitest covers schemas, permissions, session signatures, OAuth state/PKCE, request origin rules, guarded commands, cache eligibility, plugin signatures/capabilities, MCP catalog visibility, media validation, and deployment-configuration allowlists. The public MCP Wrangler configuration is parsed as a test artifact: adding D1, R2, a service, secrets, or non-public KV to it fails the suite. Browser-extension permissions are similarly pinned to user-initiated activeTab and scripting; persistent host permissions are forbidden.

Real workerd integration

Cloudflare’s Vitest integration runs Workers in workerd with isolated storage per test file.

  • The tenant suite applies the real D1 migrations, verifies verified-domain lookup, exercises two separate SQLite Durable Object identities, atomically saves/publishes the pages-navigation-redirects bundle and proves stale-version rollback, writes/reads an R2 object, proves a cross-tenant key miss, processes a publish queue batch, deletes a real Cache API entry, writes the public KV index, and checks explicit queue acknowledgement/durable status.
  • The managed tenant user-Worker suite proves fixed script-local Durable Object selection, public draft/mutation denial, immutable publish-event operation claims, private draft reads, and private MCP reads/idempotent mutations through tenant-pinned grants. It also proves write-scope enforcement and explicit publication confirmation. Node boundary tests add ready Queue/tenant/site/service resolution, revocable signed sessions, authoritative roles, cross-tenant denial, public fallback, platform-cookie stripping, sole-consumer enforcement, retry/dead handling, bounded MCP responses, and shared-binding exclusion from tenant and public-MCP code.
  • The public MCP suite boots the actual Agents SDK Worker and its Durable Objects, writes only to PUBLIC_CONTENT, performs a Streamable HTTP MCP initialization, and verifies the server identity. This complements dry-run deployment binding output.

These suites use local emulations of Cloudflare bindings, not mocks of their storage APIs. They do not contact or mutate a Cloudflare account.

Browser E2E

Playwright starts Morning Bell in a foreground Astro dev process and validates the public/edit split in a real Chromium browser. It visits all five public routes, verifies shared navigation and anonymous metadata isolation, proves a forged mode marker alone cannot load a draft, submits the schema-defined contact form, rejects an invalid extension handoff, enters the editor on a clean URL, waits for the React overlay to hydrate, saves a schema-defined field, verifies draft preview, confirms separate anonymous isolation before publish, publishes, exits edit mode, and verifies the public result. It also completes the guided page lifecycle from template creation through rename, synchronized navigation, atomic publication, deletion, and old-route redirects. A separate test executes the extension popup with the Chrome tabs and scripting surfaces and asserts the exact same-site nested OAuth/editor-entry URL.

The browser suite deliberately uses only the local POC identity. Production OAuth cryptographic and authorization behavior remains covered at the contract/workerd layers without sending credentials to a test browser.

CI commands

pnpm test
pnpm check
pnpm build

pnpm test runs Node Vitest, tenant workerd, public MCP workerd, and Chromium E2E in order. Install the pinned browser once on a new runner with pnpm exec playwright install chromium. Missing production secrets during the local Astro build are expected warnings; production deployment must supply them through Wrangler secrets.