跳转到正文
报告库
用途分类 / 其他用途

Clerk Setup Skill 安全审计

作者说它能做什么(原文)

Add Clerk authentication to any project by following the official quickstart

第三方安全检查结论

先别安装或运行

已检查文件
2
发现的风险
5
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
中风险

代理被要求执行从可变网页提取的完整安装说明

原文依据:3 处
发现了什么

该 Skill 让代理从外部快速入门页面提取全部代码和配置步骤,然后逐项执行,包括安装软件包和修改认证文件。即使当前 URL 属于 Clerk,网页内容也可随时间改变,Skill 本身没有固定版本或要求用户复核将执行的命令。

为什么需要注意

如果获取到的指南被错误更新、其依赖被破坏,或提取结果不适用于当前项目,代理可能安装不合适的软件或更改认证边界,造成构建失败或访问控制错误。

该 Skill 主动要求从 Clerk 网页提取“完整”说明并逐步执行,其中包括安装包、设置环境变量和修改认证中间件。外部页面是官方地址且行为符合认证设置目的,但内容可变,所提供行中没有执行前复核命令或文件改动的要求。用户可限制为先展示网页来源、命令和差异,获批后再执行。

SKILL.md:141来自说明文档打开原文件
Use WebFetch to retrieve the official quickstart for the detected framework:```WebFetch: https://clerk.com/docs/{framework}/getting-started/quickstartPrompt: "Extract the complete setup instructions including all code snippets, file paths, and configuration steps."```
查看另外 2 个位置
SKILL.md:150来自说明文档打开原文件
Execute each step from the quickstart guide:- Install the required packages- Set up environment variables- Add the provider and proxy/middleware- Create sign-in/sign-up routes if needed- Test the integration
SKILL.md:148来自说明文档打开原文件
### 3. Follow the InstructionsExecute each step from the quickstart guide:- Install the required packages- Set up environment variables- Add the provider and proxy/middleware- Create sign-in/sign-up routes if needed- Test the integration
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 1 项风险
中风险

生产密钥可被直接拉取到自动选择的本地环境文件

原文依据:2 处
发现了什么

日常操作明确提供 clerk env pull --instance prod,而框架检测逻辑会自动选择变量名和目标环境文件。该段没有要求在写入前确认具体文件、文件权限或版本控制排除规则。

为什么需要注意

如果自动选择的文件会被提交、备份、同步或被其他本地用户读取,生产 secret key 可能泄露;写入错误项目也会扩大凭据暴露范围。

日常操作明确包含拉取生产密钥;另一条说明称 CLI 会自动选择变量名和 `.env` 类目标文件。该功能对部署可能合法,但会把高敏感生产凭据写到本地,而所引行文没有要求确认目标文件、权限或版本控制排除状态。用户可限制生产拉取必须明确批准,并要求先显示目标路径及忽略规则。

SKILL.md:55来自说明文档打开原文件
```bashclerk env pull                        # refresh keys (uses linked profile)clerk env pull --instance prod        # production keysclerk doctor --json                   # framework integration health check```
查看另外 1 个位置
SKILL.md:77来自说明文档打开原文件
- Pass `--json` on `apps list/create`, `users create`, and `doctor` for parseable output.- The CLI auto-detects framework env var names (`VITE_CLERK_PUBLISHABLE_KEY` for Vite, `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` for Next.js, etc.) and target file (`.env.development.local` > `.env.local` > `.env`).
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 1 项风险
中风险

一条自动确认命令会安装依赖、改写项目并创建外部 Clerk 应用

原文依据:2 处
发现了什么

新项目流程使用带 -y 的 clerk init。文档称该命令会安装 SDK、连接项目、写入密钥,并在未登录时创建一个可认领的外部应用;这些动作组合在一次无需交互确认的命令中。

为什么需要注意

在选错项目目录、框架判断错误或用户只想查看方案时,可能产生非预期依赖和代码/环境文件修改,并留下用户未计划创建的 Clerk 资源。环境文件中的密钥也会成为需要保护的本地凭据。

这是新项目场景中的主动命令,`-y` 表示自动确认。文档明确称它会安装 SDK、修改项目并写入发布及秘密密钥;未登录时还会配置一个可认领的无账户应用。这符合“添加 Clerk”的目的,但一次命令同时产生本地和外部状态。用户可要求先确认项目路径、拟改文件及是否允许创建外部应用。

SKILL.md:25来自说明文档打开原文件
```bashclerk init --framework <next|react|vue|nuxt|astro|react-router|tanstack-react-start|expressjs|fastify|expo> -y```
查看另外 1 个位置
SKILL.md:29来自说明文档打开原文件
`clerk init` installs the SDK, wires the project up, and writes the framework-specific publishable + secret keys to the right env file (e.g. `.env.local` for Next.js, `.env` for Vite-based projects).**No login required.** On a supported framework, unauthenticated `clerk init` provisions a claimable accountless app and writes temporary development keys to the project's env file — no account, no browser, no flag. Don't run `clerk auth login` first. Authenticated (or with `--app` / `--login`) it creates and links a real app via PLAPI instead.
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
高风险

原始 API 命令可轮换应用密钥,并在 24 小时后使旧密钥失效

原文依据:3 处
发现了什么

该 Skill 给出了直接调用平台 API 轮换 secret key 的命令,并设置旧密钥仅保留 24 小时。它没有在命令旁要求确认目标是开发还是生产应用,也没有要求先验证所有部署已更新。

为什么需要注意

如果对错误应用执行,或新密钥没有及时部署到所有服务,旧密钥到期后服务端 Clerk 调用和认证流程可能失败,导致生产登录或受保护功能中断。

这是一条可直接改变 Clerk 应用凭据的主动 API 命令,不是仅描述风险。参数使旧密钥在 24 小时宽限期后失效;若目标应用选错或部署未及时更新,服务可能中断。轮换本身属于正常安全维护,但这些行未要求核对环境或部署状态。用户可要求作者加入目标应用、环境和部署完成情况的明确确认。

SKILL.md:63来自说明文档打开原文件
PLAPI exposes secret-key rotation directly. Use raw `clerk api` until the friendly wrapper ships:```bashclerk api --platform POST /v1/platform/applications/<app_id>/rotate_secret_keys \  -d '{"delay_old_secrets_expiration_hours": 24, "reason": "scheduled rotation"}'```
查看另外 2 个位置
SKILL.md:70来自说明文档打开原文件
`delay_old_secrets_expiration_hours` keeps the old key valid for the grace period so deploys can roll forward without downtime.
SKILL.md:61来自说明文档打开原文件
### Rotate the secret key (replaces Dashboard rotation)PLAPI exposes secret-key rotation directly. Use raw `clerk api` until the friendly wrapper ships:```bashclerk api --platform POST /v1/platform/applications/<app_id>/rotate_secret_keys \  -d '{"delay_old_secrets_expiration_hours": 24, "reason": "scheduled rotation"}'```
低风险

安装命令没有固定依赖版本

原文依据:4 处
发现了什么

安装命令没有指定依赖版本。同样的命令以后可能下载不同代码,你实际安装的内容可能与这次检查时不同。

为什么需要注意

即使命令和报告没变,以后安装时也可能下载到另一份代码。

这是实际安装命令,不是示例中的否定或警告;它未指定 @clerk/ui 的版本。执行时会解析当时的软件包版本,因此依赖内容可能随时间变化。该操作符合添加 Clerk 主题的用途,但用户可要求锁定经审核的版本并保留锁文件。

shadcn 主题安装步骤同样使用未固定版本的 @clerk/ui。它是有条件的正常功能(项目使用 shadcn/ui 时),但未来执行可能获得与审计时不同的代码。用户可要求固定版本并先检查锁文件差异。

SKILL.md:266来自说明文档打开原文件
```bashnpm install @clerk/ui```
查看另外 3 个位置
SKILL.md:263来自说明文档打开原文件
Themes are installed from `@clerk/ui`:```bashnpm install @clerk/ui```
SKILL.md:276来自说明文档打开原文件
```bashnpm install @clerk/ui```
SKILL.md:273来自说明文档打开原文件
If the project uses shadcn/ui (check for `components.json` in the project root), apply the shadcn theme so Clerk components match the app's design system:```bashnpm install @clerk/ui```
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该 Skill 会先读取 package.json 判断框架,然后从 Clerk 官方文档获取对应的快速入门指南,并要求代理执行安装、环境变量、认证中间件和测试等步骤。

查看原文
SKILL.md:137来自说明文档打开原文件
Read the project's `package.json` and match dependencies to the table above.
SKILL.md:141来自说明文档打开原文件
Use WebFetch to retrieve the official quickstart for the detected framework:```WebFetch: https://clerk.com/docs/{framework}/getting-started/quickstartPrompt: "Extract the complete setup instructions including all code snippets, file paths, and configuration steps."```
SKILL.md:150来自说明文档打开原文件
Execute each step from the quickstart guide:- Install the required packages- Set up environment variables- Add the provider and proxy/middleware- Create sign-in/sign-up routes if needed- Test the integration

对于新项目,首选流程是一条 clerk init 命令;文档称它会安装 SDK、修改项目集成,并在未登录时创建可认领的外部 Clerk 应用及临时密钥。

查看原文
SKILL.md:25来自说明文档打开原文件
```bashclerk init --framework <next|react|vue|nuxt|astro|react-router|tanstack-react-start|expressjs|fastify|expo> -y```
SKILL.md:29来自说明文档打开原文件
`clerk init` installs the SDK, wires the project up, and writes the framework-specific publishable + secret keys to the right env file (e.g. `.env.local` for Next.js, `.env` for Vite-based projects).**No login required.** On a supported framework, unauthenticated `clerk init` provisions a claimable accountless app and writes temporary development keys to the project's env file — no account, no browser, no flag. Don't run `clerk auth login` first. Authenticated (or with `--app` / `--login`) it creates and links a real app via PLAPI instead.

对于已有应用,该 Skill 提供 OAuth 登录、创建或链接 Clerk 应用以及拉取开发或生产密钥的命令;无明确应用 ID 时,它要求询问用户而不是猜测。

查看原文
SKILL.md:37来自说明文档打开原文件
```bashclerk auth login                      # one-time OAuth (skip if already logged in)clerk link                            # autolinks if a CLERK_PUBLISHABLE_KEY is in your .envclerk link --app app_xxx              # explicit form, required in agent modeclerk env pull                        # writes the framework-detected env vars```
SKILL.md:46来自说明文档打开原文件
```bashclerk auth loginclerk apps create "My App" --json     # returns the new app_idclerk link --app app_xxxclerk env pull```
SKILL.md:75来自说明文档打开原文件
- Unclaimed accountless apps created by `clerk init` are configurable without an account — see the [accountless command table](../clerk-cli/references/auth.md#accountless-operating-without-an-account) for which commands work and which need a claimed app.- `clerk link` (no flags) only autolinks when a `CLERK_PUBLISHABLE_KEY` is already in `.env` / `.env.local`. Without it, agent mode errors out: "Cannot select an application in agent mode." When that happens, run `clerk apps list --json`, and ask the user which `app_id` to link rather than guessing.- Pass `--json` on `apps list/create`, `users create`, and `doctor` for parseable output.

迁移部分要求先审计现有认证并制定方案,明确指出切换会终止现有会话;它还提到导出用户并通过 Clerk 后端 API 导入。

查看原文
SKILL.md:178来自说明文档打开原文件
If the project already has authentication, create a migration plan before replacing it.
SKILL.md:200来自说明文档打开原文件
2. **Create migration plan** - Consider:   - **User data export** - Export users and import via Clerk's Backend API   - **Password hashes** - Clerk can upgrade hashes to Bcrypt transparently   - **External IDs** - Store legacy user IDs as `external_id` in Clerk   - **Session handling** - Existing sessions will terminate on switch
从这里开始 · 工作说明SKILL.md
clerk-setup
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。 另有 2 个章节,可在原文件中查看。
文件与检查记录2 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文
  • evals/evals.json已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明
  • evals/evals.json配套文件

代码和说明中提到的操作

运行命令
SKILL.md:25来自说明文档打开原文件
```bashclerk init --framework <next|react|vue|nuxt|astro|react-router|tanstack-react-start|expressjs|fastify|expo> -y
SKILL.md:37来自说明文档打开原文件
```bashclerk auth login                      # one-time OAuth (skip if already logged in)
SKILL.md:46来自说明文档打开原文件
```bashclerk auth login
读取密钥或账号配置
SKILL.md:29来自说明文档打开原文件
`clerk init` installs the SDK, wires the project up, and writes the framework-specific publishable + secret keys to the right env file (e.g. `.env.local` for Next.js, `.env` for Vite-based projects).
SKILL.md:39来自说明文档打开原文件
clerk auth login                      # one-time OAuth (skip if already logged in)clerk link                            # autolinks if a CLERK_PUBLISHABLE_KEY is in your .envclerk link --app app_xxx              # explicit form, required in agent mode
SKILL.md:75来自说明文档打开原文件
- Unclaimed accountless apps created by `clerk init` are configurable without an account — see the [accountless command table](../clerk-cli/references/auth.md#accountless-operating-without-an-account) for which commands work and which need  - `clerk link` (no flags) only autolinks when a `CLERK_PUBLISHABLE_KEY` is already in `.env` / `.env.local`. Without it, agent mode errors out: "Cannot select an application in agent mode." When that happens, run `clerk apps list --json`, and ask the user which `app_id` to link rather than guessing.- Pass `--json` on `apps list/create`, `users create`, and `doctor` for parseable output.
连接外部网站
SKILL.md:88来自说明文档打开原文件
| 3. Follow instructions | Execute steps; create `proxy.ts` (Next.js <=15: `middleware.ts`) || 4. Get API keys | From [dashboard.clerk.com](https://dashboard.clerk.com/~/api-keys) |
SKILL.md:98来自说明文档打开原文件
|------------|-----------|----------------|| `next` | Next.js | `https://clerk.com/docs/nextjs/getting-started/quickstart` || `@remix-run/react` | Remix (deprecated) | Migrate to React Router v7 — use the React Router quickstart below |
SKILL.md:100来自说明文档打开原文件
| `@remix-run/react` | Remix (deprecated) | Migrate to React Router v7 — use the React Router quickstart below || `react-router` | React Router (v7+) | `https://clerk.com/docs/react-router/getting-started/quickstart` || `astro` | Astro | `https://clerk.com/docs/astro/getting-started/quickstart` |
安装其他软件包
SKILL.md:266来自说明文档打开原文件
```bashnpm install @clerk/ui```
SKILL.md:276来自说明文档打开原文件
```bashnpm install @clerk/ui```
读取了多少行
407
文件校验值(用于核对版本)
adde66a7c0a963a1e652ec060e4a607d5bf071b2649833508a70fd16022d447a