跳转到正文
报告库
用途分类 / 数据分析

Prisma Postgres Setup Skill 安全审计

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

Set up a new Prisma Postgres database and connect it to a local project using the Management API. Use when asked to "set up a database", "create a Prisma Postgres project", "get a connection string", "connect my app to Prisma Postgres", or "provision a database".

第三方安全检查结论

先别安装或运行

已检查文件
5
发现的风险
3
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。未发现风险
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 1 项风险
中风险

要求把工作区级服务令牌粘贴到对话中

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

如果环境中没有令牌,技能明确要求用户把令牌粘贴到聊天;该令牌不是仅限当前项目,而是可访问工作区中的全部项目、数据库和连接。对话记录、代理上下文或可见日志因此可能持有高权限凭据。

为什么需要注意

令牌一旦被非预期人员或系统取得,可用于查看或操作整个 Prisma 工作区内的资源,而不只是本次新建的数据库。

没有现有令牌时,活跃流程明确要求用户把令牌粘贴到对话中。参考文档说明该令牌可访问整个工作区的所有项目、数据库和连接,因此聊天记录或代理上下文暴露会影响不止当前项目。用户可要求改用受控环境变量或密钥管理器,并使用专用、短期且事后轮换的令牌。

SKILL.md:47来自说明文档打开原文件
**1a. Token in the user's prompt**Check if the user included a service token in their initial message (e.g., "Set up Prisma Postgres with token eyJ..."). If so, use it **exactly as provided** — do not truncate, re-encode, or round-trip it through a file. Store it in a shell variable for subsequent calls.**1b. Token in the environment**Check for `PRISMA_SERVICE_TOKEN` in the environment or `.env` file.**1c. Ask the user to create one**If no token is available, instruct the user:> Create a service token in Prisma Console → Workspace Settings → Service Tokens.> Copy the token and paste it here.Read `references/auth.md` for details on service token creation.Once you have a token, store it in a shell variable (`PRISMA_SERVICE_TOKEN`) and use it for all subsequent API calls.
查看另外 4 个位置
references/auth.md:7来自说明文档打开原文件
Service tokens authenticate server-to-server requests. They are scoped to a workspace and grant access to all resources within it.
references/auth.md:31来自说明文档打开原文件
### Token scopeService tokens are workspace-scoped. A single token grants access to all projects, databases, and connections within the workspace. There are no project-scoped tokens at this time.
SKILL.md:55来自说明文档打开原文件
**1c. Ask the user to create one**If no token is available, instruct the user:> Create a service token in Prisma Console → Workspace Settings → Service Tokens.> Copy the token and paste it here.
references/auth.md:35来自说明文档打开原文件
### Security practices- Store tokens in environment variables or secret managers, never in source code- Add `.env` to `.gitignore` to prevent accidental commits- Rotate tokens periodically via Console → Workspace Settings → Service Tokens- In CI/CD, store tokens as encrypted secrets (e.g., GitHub Secrets)
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 1 项风险
高风险

达到数据库限额时会永久删除现有项目及其全部数据库

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

创建失败时,技能把删除现有项目作为自动恢复步骤:用户在菜单中选中一个项目后便删除并重试。引用文档说明该删除会永久移除项目及其所有数据库,但主流程没有要求单独确认项目 ID、展示受影响数据库或确认备份。

为什么需要注意

一次误选可能永久删除生产或共享项目、其中的全部数据库及数据,连接也会失效。

仅在创建因限额失败且用户从交互菜单选中项目后,流程才会删除;这提供了一定授权,但没有要求再次确认、列出其中数据库或核实备份。参考文档明确删除项目会永久删除其全部数据库。用户可要求执行前显示准确项目 ID、所有受影响数据库及备份状态,并单独确认永久删除。

SKILL.md:104来自说明文档打开原文件
If the response status is `provisioning`, wait a few seconds and poll `GET /v1/databases/<database-id>` until `status` is `ready`.**If creation fails due to a database limit**, list the user's existing projects and present them as an interactive menu for deletion. After the user picks one, delete it and retry.Read `references/endpoints.md` for the full request/response shapes.
查看另外 1 个位置
references/endpoints.md:217来自说明文档打开原文件
## Delete project```DELETE /v1/projects/{projectId}```Permanently deletes a project and all its databases. Returns `204 No Content` on success.
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 1 项风险
低风险

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

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

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

为什么需要注意

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

该流程会执行未固定版本的 npm 安装。未来运行可能解析到不同版本及其传递依赖,改变写入本地项目和执行的代码。用户可要求作者提供经过测试的精确版本或锁文件,并在安装前审查将解析的版本。

`npx prisma init` 没有在命令中固定版本;它通常使用此前安装的本地 Prisma,但该安装本身也未固定版本。因而不同时间运行整个流程可能执行不同 Prisma 代码并创建或修改项目文件。用户可要求固定并锁定 Prisma 版本。

迁移命令会执行此前未固定版本安装的 Prisma,并对数据库应用迁移、生成客户端。版本漂移可能改变生成内容或迁移行为。用户可要求使用锁文件和明确版本,并在执行前检查迁移。

原型模式下的 `db push` 和 `generate` 也依赖此前未固定版本安装的 Prisma。经用户明确选择原型模式后,它会直接同步数据库而不保留迁移历史;版本漂移可能改变数据库或生成结果。用户可要求锁定版本并先审查架构差异。

流程运行 `npx tsx`,但列出的安装命令不包含 `tsx`。若项目中也没有该包,npx 可能临时获取当前版本,因此执行内容未固定;脚本还会使用数据库凭据连接数据库。用户可要求把经过测试的 `tsx` 精确版本加入锁文件,或拒绝临时下载。

Studio 命令没有在调用处固定版本,且依赖此前未固定版本安装的 Prisma。运行它会启动可视化数据库浏览器,因此解析到不同版本时,拥有数据库访问权并执行的代码也会变化。用户可要求锁定 Prisma 及依赖版本后再启动。

SKILL.md:128来自说明文档打开原文件
```bashnpm install prisma @prisma/client @prisma/adapter-pg pg dotenv```
查看另外 10 个位置
SKILL.md:125来自说明文档打开原文件
1. Install dependencies:```bashnpm install prisma @prisma/client @prisma/adapter-pg pg dotenv```
SKILL.md:148来自说明文档打开原文件
5. If `prisma/schema.prisma` does not exist, run `npx prisma init` to scaffold the project. This creates both `prisma/schema.prisma` and `prisma.config.ts`.
SKILL.md:127来自说明文档打开原文件
```bashnpm install prisma @prisma/client @prisma/adapter-pg pg dotenv```
SKILL.md:190来自说明文档打开原文件
```bashnpx prisma migrate dev --name init```
SKILL.md:187来自说明文档打开原文件
Once the schema has models and the user is ready, create a migration and generate the client:```bashnpx prisma migrate dev --name init```This creates migration files in `prisma/migrations/` **and** generates the client in one step. Migration history is essential for CI/CD workflows (`prisma migrate deploy`) and production deployments.
SKILL.md:195来自说明文档打开原文件
Only use `npx prisma db push` if the user explicitly asks for prototyping-only mode (no migration history). In that case, follow it with `npx prisma generate`.
SKILL.md:223来自说明文档打开原文件
```bashnpx tsx test-connection.ts```
SKILL.md:220来自说明文档打开原文件
Run it:```bashnpx tsx test-connection.ts```
SKILL.md:238来自说明文档打开原文件
- **Prisma Studio (CLI):** `npx prisma studio` — opens a visual data browser locally- **Console:** `https://console.prisma.io/<workspaceId>/<projectId>/<databaseId>/dashboard` — strip the prefixes (`wksp_`, `proj_`, `db_`) from the IDs returned in Step 3 to build this URL
SKILL.md:236来自说明文档打开原文件
Then share links for the user to explore their database:- **Prisma Studio (CLI):** `npx prisma studio` — opens a visual data browser locally- **Console:** `https://console.prisma.io/<workspaceId>/<projectId>/<databaseId>/dashboard` — strip the prefixes (`wksp_`, `proj_`, `db_`) from the IDs returned in Step 3 to build this URL
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

6 个说明模块

该技能会使用 Prisma 工作区服务令牌调用官方 Management API,列出区域、创建项目和数据库,并取得包含数据库凭据的直连字符串。

查看原文
SKILL.md:71来自说明文档打开原文件
```bashcurl -s -H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \  https://api.prisma.io/v1/regions/postgres```
SKILL.md:84来自说明文档打开原文件
```bashcurl -s -X POST https://api.prisma.io/v1/projects \  -H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "name": "<project-name>",    "region": "<region-id>",    "createDatabase": true  }'```
SKILL.md:96来自说明文档打开原文件
The response is wrapped in `{ "data": { ... } }`. Extract:- `data.id` — the project ID (prefixed with `proj_`)- `data.database.id` — the database ID (prefixed with `db_`)- `data.database.connections[0].endpoints.direct.connectionString` — the direct PostgreSQL connection stringUse the **direct** connection string (`endpoints.direct.connectionString`). Do not use the pooled or accelerate endpoints — those are for legacy Accelerate setups and not needed for new projects.

它会更改本地项目:安装五个 npm 包、把数据库连接字符串追加到 `.env`、调整 Prisma 配置和模式,并运行会在数据库中创建迁移的命令。

查看原文
SKILL.md:125来自说明文档打开原文件
1. Install dependencies:```bashnpm install prisma @prisma/client @prisma/adapter-pg pg dotenv```
SKILL.md:138来自说明文档打开原文件
2. Write the direct connection string to `.env`. **Append** to the file if it already exists — do not overwrite existing entries:```DATABASE_URL="<direct-connection-string>"```3. Verify `.gitignore` includes `.env`. Create `.gitignore` if it does not exist. Warn the user if `.env` is not gitignored.4. Ensure `package.json` has `"type": "module"` set (Prisma 7 generates ESM output).
SKILL.md:187来自说明文档打开原文件
Once the schema has models and the user is ready, create a migration and generate the client:```bashnpx prisma migrate dev --name init```This creates migration files in `prisma/migrations/` **and** generates the client in one step. Migration history is essential for CI/CD workflows (`prisma migrate deploy`) and production deployments.

该技能包含部分保护措施:仅展示可用区域;在生成新数据模型后、推送数据库前请求确认;并要求将 `.env` 排除在版本控制之外。

查看原文
SKILL.md:75来自说明文档打开原文件
The response contains an array of regions with `id`, `name`, and `status`. Only present regions where `status` is `available`.**Present the regions as an interactive menu** — let the user pick from options rather than typing a region ID manually.
SKILL.md:184来自说明文档打开原文件
1. **"I'll define my schema manually"** — Tell the user to edit `prisma/schema.prisma` and come back when ready. Wait for them before proceeding.2. **"Give me a starter schema"** — Add a Blog starter schema (User, Post, Comment with relations) to `prisma/schema.prisma`. Show the user what was added and ask if they want to adjust it before pushing.3. **"I'll describe what I need"** — Ask the user to describe their data model in natural language (e.g., "I'm building a task manager with projects, tasks, and team members"). Generate a schema from the description, show it, and ask for confirmation before pushing.
SKILL.md:144来自说明文档打开原文件
3. Verify `.gitignore` includes `.env`. Create `.gitignore` if it does not exist. Warn the user if `.env` is not gitignored.
从这里开始 · 工作说明SKILL.md
prisma-postgres-setup
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

4 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录5 个文件

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文
  • references/api-basics.md已纳入全文
  • references/auth.md已纳入全文
  • references/endpoints.md已纳入全文
  • references/prisma7-client.md已纳入全文

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

  • SKILL.md工作说明
  • references/api-basics.md配套文件
  • references/auth.md配套文件
  • references/endpoints.md配套文件
  • references/prisma7-client.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:32来自说明文档打开原文件
- Node.js 18+- A Prisma Postgres workspace (create one at https://console.prisma.io if needed)- A workspace service token (see `references/auth.md`)
SKILL.md:71来自说明文档打开原文件
```bashcurl -s -H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \  https://api.prisma.io/v1/regions/postgres
SKILL.md:72来自说明文档打开原文件
curl -s -H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \  https://api.prisma.io/v1/regions/postgres```
读取密钥或账号配置
SKILL.md:53来自说明文档打开原文件
Check for `PRISMA_SERVICE_TOKEN` in the environment or `.env` file.
SKILL.md:136来自说明文档打开原文件
- `pg` — Node.js PostgreSQL driver (used by the adapter)- `dotenv` — loads `.env` variables for `prisma.config.ts`
SKILL.md:138来自说明文档打开原文件
2. Write the direct connection string to `.env`. **Append** to the file if it already exists — do not overwrite existing entries:
运行命令
SKILL.md:70来自说明文档打开原文件
```bashcurl -s -H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \
SKILL.md:83来自说明文档打开原文件
```bashcurl -s -X POST https://api.prisma.io/v1/projects \
SKILL.md:114来自说明文档打开原文件
```bashcurl -s -X POST https://api.prisma.io/v1/databases/<database-id>/connections \
安装其他软件包
SKILL.md:128来自说明文档打开原文件
```bashnpm install prisma @prisma/client @prisma/adapter-pg pg dotenv```
SKILL.md:148来自说明文档打开原文件
5. If `prisma/schema.prisma` does not exist, run `npx prisma init` to scaffold the project. This creates both `prisma/schema.prisma` and `prisma.config.ts`.
SKILL.md:190来自说明文档打开原文件
```bashnpx prisma migrate dev --name init```
读取了多少行
721
文件校验值(用于核对版本)
e8756db6cefcb202646fa9420ea838d4142c4c42a26090083431d080f89847e0