From 76021dfb8d33391399de466d3f6e0dee21cb9387 Mon Sep 17 00:00:00 2001 From: Kranthi Kumar Muppala Date: Sat, 18 Apr 2026 11:37:50 -0700 Subject: [PATCH 1/3] chore: comprehensive code-review fixes across security, a11y, perf, tests Synthesis of a multi-agent review covering security, a11y, perf, code quality, and testing. Grouped by theme: Security - Bump DOMPurify 3.3.3 -> 3.4.0, isomorphic-dompurify -> 3.9.0, js-yaml -> 4.1.1 to pick up published XSS / prototype-pollution fixes. - Replace hand-rolled regex sanitizer in svg/svg-viewer with DOMPurify (SVG profile, explicit FORBID_TAGS/FORBID_ATTR). - Gate script/form sandbox permissions behind opt-in htmlPreviewAllowScripts (ToolUIConfig); only HTML playground opts in. - Raise AES-GCM PBKDF2 iterations 100k -> 600k (encrypt+decrypt in lockstep) to match current OWASP guidance. - Emit URL-safe base64 from jwt/fernet-encoder per Fernet spec. - Warn in jwt/jwt-decoder description that signatures are NOT verified. - Tighten CSP in public/_headers: drop unused cdn.jsdelivr.net, add base-uri and form-action self-only. Accessibility - aria-haspopup="dialog" on hero + header search buttons. - Drop onCloseAutoFocus={preventDefault} from theme / locale dropdown menus so Radix returns focus to the trigger. - aria-hidden decorative canvas (code-rain) and typewriter cursor. - Respect prefers-reduced-motion in tool-demo typewriter (JS-driven). - Darken light-mode --muted-foreground (#737373 -> #616161) to hit AA on --muted; remove opacity:0.8 override that worsened it. - Rewire file-upload to a real )} {allowFileUpload && ( - + )} {value && ( diff --git a/apps/web/components/editor/output-panel.tsx b/apps/web/components/editor/output-panel.tsx index 7d9a96c..e757a2b 100644 --- a/apps/web/components/editor/output-panel.tsx +++ b/apps/web/components/editor/output-panel.tsx @@ -201,6 +201,11 @@ interface OutputPanelProps { * @default false */ isAutoMode?: boolean; + /** + * For HTML renderer: whether the sandboxed iframe may run scripts and + * submit forms. Defaults to false; opt in only for interactive tools. + */ + htmlPreviewAllowScripts?: boolean; /** * Additional CSS classes */ @@ -216,6 +221,7 @@ export function OutputPanel({ onCopy, onDownload, isAutoMode = false, + htmlPreviewAllowScripts = false, className, }: OutputPanelProps): React.ReactElement { const t = useTranslations("editor.output"); @@ -399,6 +405,7 @@ export function OutputPanel({ diff --git a/apps/web/components/effects/code-rain.tsx b/apps/web/components/effects/code-rain.tsx index 7ffe60a..25e9db3 100644 --- a/apps/web/components/effects/code-rain.tsx +++ b/apps/web/components/effects/code-rain.tsx @@ -150,5 +150,5 @@ export function CodeRain({ className }: CodeRainProps): React.ReactElement { }; }, [prefersReducedMotion, initParticles]); - return ; + return