dillon1000/react

Commit

[compiler][playground] parse compiler configs using json5 (#36159)

Compiler config parsing is currently done with new Function(...) which
is a XSS vulnerability. Replacing this with json parsing for safety
reasons.

Almost all compiler options (except for moduleTypeProvider) are json
compatible, so this isn't a big change to capabilities. Previously
created playground URLs with non-default configs may not be compatible
with this change, but we should be able to get the correct config
manually (by reading the JS version)
Browse files
Changed paths7 files
First-parent comparison
M compiler/apps/playground/__tests__/e2e/__snapshots__/page.spec.ts/default-config.txt ModifiedM compiler/apps/playground/__tests__/e2e/page.spec.ts ModifiedA compiler/apps/playground/__tests__/parseConfigOverrides.test.mjs AddedM compiler/apps/playground/components/Editor/ConfigEditor.tsx ModifiedM compiler/apps/playground/lib/compilation.ts ModifiedM compiler/apps/playground/lib/defaultStore.ts ModifiedM compiler/apps/playground/package.json Modified
Patch

Files changed

Rendering syntax-highlighted changes…