# Security Headers

> Generated code must be aligned with security headers (e.g. no unsave JS eval). The permissions policy is especially relevant when changing any code related with the `navigator` object.

- Skill: `trezor/security-headers` (Agent Skill)
- Install (CLI): `npx get-skill add trezor/security-headers`
- Raw SKILL.md: https://api.skillmd.com/api/skills/trezor/security-headers/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: trezor (https://skillmd.com/u/trezor)
- Updated: 2026-11-16
- Page: https://skillmd.com/skills/trezor/security-headers

---


# Security headers

## Preview

Start local server with production build and applied security headers:

```
yarn workspace @suite-app/web-app preview
```

## Build & Preview

Build web app and run the preview command:

```
yarn workspace @suite-app/web-app build:preview
```

or

root level command:

```
yarn suite:build:web:preview
```

## Security Headers

### Permissions-Policy Rationale (Enabled Directives)

- `usb=(self)`:
    - `packages/connect/src/index.browser.ts` (`window.navigator.usb.requestDevice(...)`)
    - `packages/transport/src/transports/webusb.browser.ts`
- `camera=(self)`:
    - `packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/QrScannerModal/CameraQRReader.tsx` (`react-zxing` camera scanner used for QR input)
- `clipboard-write=(self)`:
    - `packages/dom-utils/src/copyToClipboard.ts` (`navigator.clipboard.writeText(...)`)
    - `packages/analytics-docs/src/components/AddEventModal/CopyButton.tsx`
    - `packages/analytics-docs/src/components/EventCard.tsx`
- `local-network-access=(self)`:
    - `packages/suite/src/hooks/suite/useLocalNetworkAccessPermission.ts` (`navigator.permissions.query({ name: 'local-network-access' })`)
    - `packages/connect-web/src/impl/core-in-suite-desktop.ts` (permission state check for websocket connectivity error handling)

`clipboard-read` is intentionally not enabled because current direct usage is test-only (`suite/e2e/tests/wallet/receive.test.ts`) rather than Suite Web runtime behavior.

Disabled directives (`=()`) are intentionally blocked because there is no direct web runtime use at this time.

### Direct Code References

- Header values source: `suite-app/web-app/constants/webSecurityHeaders.ts`
- Header type constraints: `suite-app/web-app/types/securityHeaders.ts`

MDN references:

- [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Permissions_Policy)
- [HTTP security headers overview](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers)

