This template provides conservative defaults for a browser extension with an optional server. A generated product must review these rules against its actual permissions, data flows, and providers.
- Manifest V3 extension pages use an explicit
script-src 'self'; object-src 'self';content security policy. - Do not add inline scripts, dynamic code evaluation, or unnecessary permissions.
- Values exposed through
VITE_variables are public and may be bundled into the extension. Never put admin keys, server credentials, or other secrets in them. - Treat captured page content as untrusted input. Bound and validate it before transport or storage.
- Keep browser-specific API calls behind the platform adapter so target differences do not bypass the extension's validation and permission boundaries.
- Parse runtime environment values with Zod at startup and fail clearly on invalid configuration.
- Do not fetch arbitrary user-supplied URLs from the server. If a product needs server-side fetching, define an allowlist and validate URL, scheme, redirects, response size, and timeout explicitly.
- Keep provider credentials and prompt construction on the server side.
- The built-in provider adapters read credentials from server-only settings (
OPENAI_API_KEY,ANTHROPIC_API_KEY, or the selected-providerAI_API_KEYfallback); never put these values inVITE_variables or extension code. - Resolve the selected provider during server composition so missing credentials and unsupported provider IDs fail before handling user analysis requests.
- Do not log page content, credentials, or complete provider prompts by default.
- Keep local
.envfiles ignored and commit only.env.exampleplaceholders. - Review new permissions, endpoints, storage, dependencies, and data retention in the product definition and an ADR when the decision is non-trivial.
- Replace the Firefox manifest's template extension ID and
data_collection_permissionsdeclaration with product-owned values before signing or publishing an add-on.