Skip to content

fix(themes): precompile validators for the desktop CSP - #1627

Merged
NewtTheWolf merged 1 commit into
mainfrom
fix/theme-validator-csp
Nov 19, 2026
Merged

NewtTheWolf merged 1 commit into
mainfrom
fix/theme-validator-csp

Conversation

@NewtTheWolf

@NewtTheWolf NewtTheWolf commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Generate standalone Ajv validators from the existing theme schemas in the web and author CLI build tooling.
  • Resolve installed themes under the desktop WebView CSP while keeping the existing schema checks and error formatting.
  • Cover catalog hydration and manifest parsing with dynamic code evaluation blocked.

Verification

  • 415 theme and VS Code import tests passed.
  • 57 create-plugin tests, the author CLI build and the theme smoke test passed.
  • Validated the published Vice City source with Node's string-code generation disabled.
  • Verified generated validators in Chromium under script-src 'self', including rejection of an invalid color.
  • Production frontend build and lint on the edited TypeScript files passed.

Reproduced on Linux Desktop 0.33.0. The 0.33.1 release branch will cherry-pick this fix onto the 0.33.0 tag.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@NewtTheWolf NewtTheWolf changed the title Fix installed themes under the desktop CSP fix(themes): precompile validators for the desktop CSP Nov 19, 2026
@kilo-code-bot

kilo-code-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

I found no issues in the changed code. I read the diff only and did not run the tests or the build.

  • The generated validators keep the original Ajv options.
  • schemaErrors produces the same text format as ajv.errorsText.
  • The file is written to a temporary path and then renamed, so concurrent builds are safe.
  • The generated .mjs file is excluded from git and Prettier.
  • The CSP test stubs Function to block dynamic code evaluation.
Files Reviewed (10 files)
  • .gitignore
  • .prettierignore
  • packages/create-plugin/tsup.config.ts
  • packages/create-plugin/vitest.config.ts
  • packages/web-ui/src/utils/themePackageValidation.ts
  • packages/web-ui/src/utils/themeSchemaValidators.d.mts
  • packages/web-ui/tests/utils/themeValidatorCsp.test.ts
  • packages/web-ui/vite.config.ts
  • packages/web-ui/vitest.config.ts
  • scripts/generate-theme-schema-validators.ts

Reviewed by claude-sonnet-5.5 · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@NewtTheWolf
NewtTheWolf merged commit 393000f into main Nov 19, 2026
10 of 12 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