Understand Content Security Policy (CSP) implementation
mainThe Oxide Web Console uses Content Security Policy (CSP) headers in both local development (via Vite) and production (via Vercel) to identify potential directive breaks early in the development lifecycle.
Base Directives
The following directives are applied to align with OWASP Secure Headers best practices:
default-src 'self': Restricts all resources to the same origin by default.style-src 'unsafe-inline' 'self': Allows same-origin CSS and inline styles (note:'unsafe-inline'is intended for eventual removal).frame-src 'none': Disallows<frame>and<iframe>elements.object-src 'none': Disallows<object>and<embed>elements.form-action 'none': Disallows traditional HTML form submissions (the console uses JS-based POSTs instead).frame-ancestors 'none': Prevents click-jacking by disallowing the site from being embedded in iframes.
Development-Specific Behavior
In development mode, an additional script-src directive is added that references a randomly-generated nonce. This nonce is injected by Vite into the generated index.html, allowing dev-mode scripts to execute without enabling 'unsafe-inline', keeping the development environment as close to production security as possible.