> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# security.nonce

- **类型：**

```ts
type Nonce = string;
```

- **默认值：** `undefined`

为 HTML 所引入的脚本资源添加随机属性值 nonce，使浏览器在解析到带有匹配 nonce 值的内联脚本时，能判断该脚本是否能执行。

:::info
该配置项的使用方式与 Rsbuild 完全一致。详细信息请参考 [Rsbuild - security.nonce](https://v2.rsbuild.dev/zh/config/security/nonce)。
:::