Validation and Scanner Rules

The validator is src/themes/validator/; the server, theme validate and theme pack all run it.

Every archive is validated at upload, again at activation and rollback (an installed theme that no longer validates is not activated), on demand with Validate in Site & Content › Themes, by theme validate and before theme pack writes an archive. One rule table (VALIDATION_RULES in src/themes/validator/rules.ts) drives all of them and the copy exported with the contract (validator.mjs), so a theme that passes locally passes on upload. A rejection names the rule and the file and line. Errors block; warnings are reported and do not.

The Theme Contract page describes the validator’s internals; this page lists what each rule means for an author.

Manifest

  • The manifest matches the schema.
  • engines.contract is a range that includes the running contract version.
  • extends, when set, names an installed theme (checked by the server at upload).
  • Every view id, part area id and section type either exists in the contract or is namespaced theme.<slug>.*.

Package

  • File extensions are from the allow-list: js css json woff2 svg png webp jpg mp3 ogg md txt.
  • Size caps: package 30 MB; CSS 500 KB; JavaScript 300 KiB gzipped in total and 120 KiB gzipped per chunk.
  • Every asset the manifest references exists.
  • Every font family has a licence file.
  • No reference to a remote font host.

CSS

  • No @import.
  • No non-relative url().
  • No expression().
  • No !important on contract nodes.
  • No display: none or visibility: hidden on data-pe-* nodes.
  • No @layer other than pe-theme.
  • Token values are colours, lengths, font stacks or same-origin paths.

JavaScript

The scanner parses every module into an abstract syntax tree and rejects the archive on any of these:

  • A module that does not parse as an ES module.
  • An import from anything but the externals list: react, react/jsx-runtime, react-dom, @pe/sdk.
  • Any read of the host object other than the one generated prologue shape.
  • eval, new Function, with.
  • WebSocket, EventSource, fetch, XMLHttpRequest, navigator.sendBeacon, Worker, ServiceWorker, importScripts, new Image.
  • document.cookie, localStorage, sessionStorage, indexedDB.
  • createElement('script'), createElement('style'), setAttribute('style', …), assignment to innerHTML or outerHTML, insertAdjacentHTML, document.write.
  • A dynamic import() outside the package’s own chunks.
  • globalThis, self, top, parent.
  • Any reference to the socket library, the shared game package, the game store, the game socket hook, gameplay event names or gameplay routes.
  • Obfuscation markers.

Bundling minified third-party libraries is not allowed, because the scanner would flag them. Themes use the SDK and plain source.

SEO markup, public templates only

One check exists today: seo.section-text warns when a hero or call-to-action section’s default has no text. The other markup rules for public templates (exactly one <h1>, landmarks, alt text from section settings, links through the SDK Link) are guidance, not validated (not yet supported); see Templates and View Ids.

Every rule

RuleSeverityFails when
manifest.missingerrortheme.json is missing
manifest.invaliderrortheme.json fails the schema (unknown fields included)
manifest.contract-rangeerrorengines.contract does not include the running contract version
manifest.unknown-viewerrorA view id is neither host-owned nor theme.<slug>.*
manifest.unknown-parterrorA part id is neither a host part area nor theme.<slug>.*
manifest.unknown-sectionerrorA section type is neither host-owned nor theme.<slug>.*
manifest.section-schemaerrorA theme section type has no schema, or a host type carries one
manifest.foreign-namespaceerrorAn id uses another theme’s theme.<other>.* namespace
manifest.layout-iderrorA layout reuses the built-in id standard
manifest.file-missingerrorA file the manifest names is not in the package
manifest.strings-missingerrorA declared language has no strings/<lang>.json
manifest.surface-tablewarningLayouts are declared without the table surface
package.patherrorA path is absolute, escapes the package, or is deeper than 20 levels
package.extensionerrorA file extension is outside the allow-list
package.sizeerrorThe package exceeds 30 MB
package.file-counterrorThe package has more than 5,000 files
package.css-sizeerrorCSS exceeds 500 KB
package.js-sizeerrorJavaScript exceeds 300 KiB gzipped in total
package.chunk-sizeerrorA chunk exceeds 120 KiB gzipped
package.font-licenseerrorA font family ships without a licence file
package.google-fontserrorfonts.googleapis.com is referenced
package.entryerrorThe entry is not under dist/, or a chunk is outside dist/chunks/
package.stray-jserrorA JavaScript file is neither the entry nor a chunk
package.json-invaliderrorA JSON file does not parse
css.importerror@import in a packaged stylesheet
css.urlerrorA url() that is not relative to the package
css.expressionerrorexpression(), behavior or -moz-binding
css.important-contracterror!important on a DOM-contract node
css.hidden-contracterrorA rule that hides a DOM-contract node
css.layererrorAn @layer other than pe-theme
css.charsetwarning@charset, which is ignored
js.parseerrorA file that does not parse as an ES module
js.importerrorAn import outside the four externals and the package’s own chunks
js.import-nameerrorA named import the external does not have
js.dynamic-importerrorimport() of anything but an own chunk
js.host-objecterrorwindow.__pokerEngine read outside the one prologue shape
js.evalerroreval, new Function, with, or code in a string
js.forbidden-apierrorA transport, storage, worker, DOM-injection or navigation API
js.forbidden-globalerrorA free global outside the allow-list
js.global-membererrorA window, document or navigator member outside the allow-list
js.computed-accesserrorComputed member access on a global root or the host object
js.prototype-escapeerror.constructor, .__proto__ or Reflect
js.dom-injectionerrorinnerHTML, outerHTML, insertAdjacentHTML, document.write, dangerouslySetInnerHTML, script or style elements
js.gameplay-referenceerrorA reference to the socket, the game store, gameplay events or gameplay routes
js.obfuscationerrorEscape-heavy identifiers or strings, decoders, minified code (a line over 2,000 characters or a mean over 300)
js.external-urlwarningAn absolute http(s) URL, listed for review
js.import-metaerrorimport.meta
tokens.invaliderrortokens.json is not an object of token name to string
tokens.unknownwarningA token name is not in the contract
tokens.valueerrorA token value does not match its kind
strings.invaliderrorA strings file is not a flat object of theme.<slug>.* keys to strings
strings.merge-tagwarningA merge tag is unknown or misformatted
seo.section-textwarningA hero or call-to-action default has no text

What the scanner is and is not

The scanner stops accidents and crude attempts. The guarantees are architectural: the server has authority over every action, the SDK is the only data path, the socket is never exposed, installing a theme needs the appearance:install permission, and a table layout needs a certification record. Two channels the content security policy leaves open, images from any HTTPS host and WebSocket connections, are a recorded limit, not something the scanner can close.

Reading a validation report

Site & Content › Themes shows the report for every installed theme, and the CLI prints the same report:

npm run theme -- validate <theme-dir | archive.tgz> [--json] [--contract <version>]

A directory is read as an extracted package (theme.json at its root, so a theme after theme build); a .tgz is read the way an upload is, with the archive’s root folder stripped. Every finding is printed on one line, errors before warnings:

js.import  error  dist/theme.js:5:1  "socket.io-client" is not an allowed import; themes import only react, react/jsx-runtime, react-dom, @pe/sdk and their own dist/chunks/*.js
css.hidden-contract  error  dist/theme.css:5:1  [data-pe="seat"] is hidden by display: none
theme validate: sample-parts@0.1.0 failed against contract 0.1.0: 2 errors, 0 warnings; 10 files, 2.6 KiB package, 0.5 KiB css, 0.5 KiB js gzipped (largest chunk 0.2 KiB)

The columns are the rule id, the severity, file:line:column (a file alone for manifest and package rules, - when no file applies) and the message. The exit code is 0 when no error finding remains (warnings do not fail), 1 on errors and 2 for a usage error such as a path that does not exist. --json prints the full report (findings, statistics, contract version) for scripts; --contract validates against another contract version than the running one.

Try the live demo Pricing

Have questions about Poker Engine? We reply fast.