
Bouncer Gates
io.github.ajeermahmood由 GitHub 账号 ajeermahmood 发布v0.5.0更新于 Oct 24, 2026
Stops secrets, cross-tenant queries and unsafe migrations before they merge.
概览
对代码仓库运行五项静态检查,发现硬编码密钥、未限定租户的查询、浮点金额计算、不安全迁移和失效文档链接。
- 可以做什么
- Bouncer Gates 通过 MCP 暴露五项检查,供智能编辑器在写代码时调用。检查项包括:密钥、作用域(租户表查询缺少租户过滤)、金额(用浮点数处理货币)、迁移安全(会破坏运行中应用的 SQL 迁移)以及文档链接(指向不存在文件的 Markdown 链接)。每条结果会给出文件、行号、问题和建议修复方式,也可以用带理由的注释豁免,或写入基线文件,使只有新问题才阻断。它同时可作为命令行工具、编辑后钩子和 GitHub Action 运行。
- 适用场景
- 当助手在仓库中编写或修改代码,而你希望在编辑器和 CI 中施加同一道低成本防线时使用。适合有多租户数据模型、涉及金额处理或 SQL 迁移的团队,在合并前拦截明显错误。
- 运行要求
- 需要 Node.js 和 npx 以 stdio 方式在本地运行该 npm 包。变更文件检查和迁移检查需要 git 仓库。初始化命令会生成可选的配置文件;未声明任何账号、API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Bouncer Gates,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
bouncer-gates
Five checks that stop the expensive mistakes before they merge, whether a person or an agent wrote the code.
Hardcoded secrets. Database queries that leak one customer's data to another. Float maths on money. Migrations that break the running app. Docs that link to files which no longer exist.
Agents write most new code now, and they make exactly these mistakes: a key pasted in to make a test pass, a query with no tenant filter because the prompt never mentioned tenants. bouncer-gates runs inside Claude Code and Cursor, so the agent hears about it in the same turn it wrote it, and again in CI so nothing gets through.
Try it on any repository in ten seconds:
Or paste some code into the playground and watch the same checks run on it.
Quick start
Add it to GitHub Actions:
That is the whole setup. Everything below is detail.
In the editor, with the agent
--init-agents commits two things into the repository: an MCP server the agent
can call, and a hook that scans every file the agent writes. When a file has a
blocking finding, the agent sees the file, the line, what is wrong and what to
do instead, in the same turn:
Any other MCP client can run npx -y bouncer-gates --mcp, and any post-edit
hook can pipe its event to npx -y bouncer-gates --hook.
How it works, and what it will not do.
What it checks
Each check exists because of a real, expensive bug. None is a style opinion. The gate reference explains every rule with a bad example and a fixed one.
When it finds something
Every finding names the file, the line, what is wrong and what to do instead:
You have three options, in this order:
- Fix it. Usually the right answer.
- Explain why it is fine. Put a comment on the line, or the line above it, with a reason. The reason is required; a bare marker does nothing.
- Record existing problems so only new ones block. On a codebase that already has findings, run this once and commit the file it writes: Old findings stop blocking. Anything new still does. The file is readable, and the count in it should only ever go down.
Configuration
bouncer-gates --init writes this for you. Edit it by hand any time.
- exclude: files not to scan at all. The run prints how many files each pattern removed, every time, so the list cannot grow quietly.
- scope.models / tables: the models and tables that belong to a tenant.
--initfills these from any model in your Prisma schema that has atenantIdfield. - scope.clients: plain client names, like
prisma, whose queries should be checked for the tenant column. Use this when you do not have a scoped wrapper. - scope.rawAccessor: if you do have a scoped wrapper, this is the name of
the raw client it hides, like
db.raw. Reaching for it gets flagged. - doc-links.repoUrl: lets absolute links back to your own repository be checked as file paths too.
Without a scope section, the scope check reports skipped, not passed.
All the commands
Exit code 0 means clean, 1 means something blocked, 2 means the tool
itself could not run (bad flag, broken config, not a git repository). CI treats
1 and 2 differently on purpose: a broken tool should not look like a
codebase full of problems.
What it does not do
Honest limits, so nobody trusts it further than it deserves:
- It matches shapes in text. It does not understand your code. A tenant filter built in a helper the check cannot see will be reported, and the comment above is the fix.
- The money and scope checks only read JavaScript and TypeScript.
- The migration check only reads
.sqlfiles. Migrations written in JavaScript or TypeScript are not checked. - Secrets split across lines, or with no recognisable prefix, are not found. For deep history scanning use gitleaks or trufflehog; this is the cheap guard on the door, not the audit.
- A query inside
prisma.$transaction(async (tx) => ...)uses a client the check cannot follow.
Every rule's blind spots are listed in the gate reference.
Words used here
- Gate or check: one of the five things it looks for.
- Finding: one problem it reports, with a file and line.
- Blocking: a finding that makes the run exit
1. Warnings do not. - Baseline: the file that records findings you have chosen to live with for now, so only new ones block.
- Acknowledge or excuse: the
bouncer-gates-okcomment that says a specific line is fine, and why.
Telemetry
One anonymous ping a day: a random id, the version, the runtime, the OS and the
Node major. Nothing about your code, ever. BOUNCER_TELEMETRY=0 turns it off.
Everything it sends.
More
- Inside the editor: the MCP server and the hook, what the agent sees, other editors
- Gate reference: every rule, a bad and a good example, what it misses
- Rolling it out on an existing codebase
- Design notes: why it never fails open, why findings never quote the secret, the false-positive story, and the speed work
- Architecture: gates are pure functions, which is why the same code runs in the CLI, in a Cloudflare Worker and in your browser
- Deployment: the playground, the API and npm
- Contributing: adding a gate, and how to decide whether something should be one
Development
Licence
MIT. Take any of it.
Built by Ajeer Mohammed. The rules come from the checks that gate a multi-tenant platform where most of the code is written by a coding agent, and where missing one meant a merchant seeing another merchant's orders. How that workflow fits together.
来源:README.md,提交 a12b315
工具
0版本历史
1- v0.5.0最新Sep 20, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分