bouncer

io.github.nugehs由 GitHub 账号 nugehs 发布v0.3.0更新于 Oct 28, 2026

Static compliance-controls checker for UK Online Safety Act & ICO Children's Code. CLI + MCP.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

静态合规检查器,用确定性规则包核验代码库中是否存在法规要求的控制项(英国《在线安全法》、ICO 儿童准则、尼日利亚规则包),并以 MCP 工具提供。

可以做什么
  • 对代码库运行合规规则包,返回每项控制项的判定结果及 file:line 证据
  • 列出当前配置规则包所适用的全部规则
  • 解释单条规则对应的标准、意图、修复方式及检查方法
  • 列出工具自带的规则包
  • 判定分为通过、失败与未知,未知不会被当作通过
适用场景
当需要让助手核查应用源码中是否真的存在年龄验证、用户生成内容上的举报/屏蔽入口、儿童高隐私默认设置等必需控制项,或在修复前了解某条规则的具体要求时适用。它补充而非替代漏洞扫描工具。
运行要求
以 stdio 本地运行,通常通过 npx 从 npm 包 @nugehs/bouncer 启动,需要 Node.js 18 或更高版本。目标仓库中需有 bouncer.config.json 来指定适配器、规则包与排除项。未声明需要账号、API 密钥或环境变量。
安装前请注意
它会读取仓库源码以生成结果,结论仅反映规则所查找的已编码控制项;项目自述为工程辅助工具而非法律意见,全部通过的报告不能替代合规或 DPO 审查。部分义务属于流程而非代码,只会作为待跟踪缺口呈现。它是静态检查器,不会修改代码。

安装

在 SourceWeft 中

  1. 打开 控制台中的 bouncer,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

bouncer

Static compliance-controls checker — the controls a regulation requires, verified in your code.

[npm] [CI] [license: MIT] [node] [dependencies]

nugehs.github.io/bouncer-web (site)

[bouncer demo]

bouncer verifies that the controls a regulation requires actually exist in your code — UK Online Safety Act, ICO Children's Code (AADC), and Nigeria (NDPC, FCCPC, FIRS) — expressed as deterministic rule packs. It runs in CI, exits non-zero when a required control is missing, and needs no LLM.

It checks IDs at the door so non-compliant code doesn't get in.

bouncer is an engineering aid, not legal advice. A green report means the coded controls a rule looks for were found — it is not a substitute for a compliance / DPO review.


Why

Regulators now expect demonstrable controls: age assurance, high-privacy defaults for children, report/block affordances on user-generated content, a DPIA, a risk assessment. Those are concrete things that either exist in a codebase or don't. bouncer turns a regulation into a set of static checks over your repo, the same way tieline turns an API contract into drift checks — the engine knows nothing about the law; the rule packs do.

bouncer vs semgrep / policy-as-code

Scanners like semgrep, CodeQL, or Snyk answer "is there bad code here?" — they hunt for vulnerabilities and dangerous patterns that shouldn't exist. bouncer answers the opposite question: "does the code the regulation requires actually exist?" — age assurance on sign-up, report/block on UGC surfaces, high-privacy defaults for children. A repo can be vulnerability-free and still fail every one of those obligations. Policy-as-code tools (OPA/Rego, Conftest) gate configs and infrastructure against policy; bouncer gates application source against regulatory rule packs, with file:line evidence for every control and an honest unknown when a surface can't be located. In short: semgrep finds vulnerabilities; bouncer proves required controls exist. They complement each other — run both.

Install

bash
npx @nugehs/bouncer initnpx @nugehs/bouncer check

Or clone and run with plain Node (zero runtime dependencies, Node ≥ 18).

Usage

bash
bouncer init [path]                 # write a starter bouncer.config.jsonbouncer check                       # run packs, print report, exit 1 on a missing controlbouncer check --pack uk-aadc        # restrict to one packbouncer check --status fail         # show only the failuresbouncer report --out report.html    # self-contained HTML audit reportbouncer list                        # every rule the configured packs applybouncer explain <ruleId>            # what a rule requires + how it is checkedbouncer packs                       # rule packs shipped with bouncerbouncer doctor                      # sanity-check config, adapter, packsbouncer mcp                         # start the MCP server (stdio)

Verdicts

VerdictMeaning
passthe required control was found (evidence: file:line)
failthe surface exists, but no evidence of the control was found
unknownthe surface could not be located in this repo — can't determine, not a pass

unknown is deliberate: bouncer never reports a green pass for a surface it could not find. Missing surface → honest "can't determine".

Configuration

bouncer.config.json:

json
{  "target": {    "adapter": "auto",    "repo": "./my-app",    "roots": ["."]  },  "packs": ["uk-osa", "uk-aadc"],  "packDirs": [],  "ignore": [],  "exclude": [],  "failOn": ["fail"]}
  • adapter — how regulation surfaces (sign-up, profile, chat, livestream…) map onto files for your stack.

bouncer is language-agnostic. The default auto adapter scans TS/JS, Go, Java, Kotlin, Scala, C#, C/C++, Rust, Swift, Dart, PHP, Python, Ruby, Elixir, SQL and HTML templates. Surfaces are found by directory/file names in any naming convention (signup/, sign_up.py, SignUpController.java). Comments and test/fixture files are never counted as evidence. next and react-native remain as TS/JS-only aliases. Narrow with target.languages.

  • exclude — extra globs to skip (added to built-in test/fixture/mock excludes; set "defaultExcludes": false to disable those).
  • packs — which rule packs to run. Built-ins: uk-osa, uk-aadc, ng-ndpc, ng-fccpc, ng-firs.
  • packDirs — extra directories of your own *.json packs.
  • ignore — rule ids to skip.
  • failOn — which buckets make check exit non-zero (default ["fail"]). Regardless of failOn, check also exits 1 when every rule is unknown: no surface was located, so nothing was verified.
  • Keys starting with _ (e.g. "_note") are treated as comments and ignored silently.

Rule packs

A pack is JSON. Each rule maps a legal standard to a static assertion over a surface:

json
{  "id": "aadc.geolocation-default-off",  "standard": "Standard 10 — Geolocation",  "severity": "high",  "surface": "profile",  "intent": "Geolocation must default to off for children.",  "fix": "Default any location-sharing setting to off.",  "assert": {    "find": "(share[_-]?location|location[_-]?sharing)[\"']?\\s*[:=]\\s*(false|off)\\b",    "in": ["profile", "privacy", "location"],    "expect": "present"  }}

Assertion nodes:

  • { "find": "<regex>", "in": "<surface|glob>", "expect": "present|absent" }
  • { "allOf": [ … ] } · { "anyOf": [ … ] } · { "not": … }

in accepts a surface alias (resolved by the adapter), an array of aliases/globs, or a raw glob. expect: "absent" flips the meaning — a match is a violation (used for nudge patterns, self-declared age checkboxes, etc.).

Surfaces

any, signup, auth, profile, privacy, location, chat, livestream, ugc, moderation, consent, legal, dsr, security, retention, breach, processors, payments, invoice, governance. Unknown surface names are pack-validation errors.

Nigeria packs

For a platform operating in Nigeria, three packs ship built-in:

  • ng-ndpc — Nigeria Data Protection Act 2023 (NDPC): privacy notice, opt-in & granular consent, data-subject rights, encryption, retention/erasure, NDPA localization, DPO designation, 72-hour breach plan, cross-border safeguards.
  • ng-fccpc — consumer protection (FCCPC): blanket "no refund / all sales final" clauses flagged as void — and high-precision, so a tiered or conditional refund policy doesn't trip it — plus refund-policy present, no drip pricing, explicit terms acceptance, terms of service present.
  • ng-firs — tax (FIRS): 7.5% VAT rate, VAT on commission, WHT on payouts, VAT tax invoice.

Some obligations are process, not code — NDPC registration, signed cross-border DPAs, the WHT remittance itself. Those rules surface as gaps to track (add them to ignore with a note), not things a static scan can prove.

MCP

bouncer is also an MCP server (stdio), so an agent can pull the same deterministic results:

ToolPurpose
compliance_checkrun packs, return per-control verdicts + evidence
list_ruleslist rules the configured packs apply
explain_rulea rule's standard, intent, fix, and how it is checked
list_packsavailable rule packs
jsonc
// .mcp.json{ "mcpServers": { "bouncer": { "command": "npx", "args": ["-y", "@nugehs/bouncer", "mcp"] } } }

CI

yaml
- run: npx @nugehs/bouncer check

Fails the build when a required control goes missing — e.g. someone removes an age-gate or a report button from a UGC surface.

Tests

bash
npm test    # node --test — zero dependencies, nothing to install

The suite runs on Node's built-in test runner against throwaway fixture repos: glob/brace expansion, every assertion probe (find, allOf/anyOf/not, allInFile + within windows, expect: "absent"), the pass/fail/unknown verdict semantics, and pack loading. CI runs it on Node 18, 20, 22, and 24.

License

MIT


Part of the toolchain

bouncer is one of four tools that form a deterministic trust layer for AI-assisted development. Each answers a question people keep handing to an LLM — with static analysis instead.

  • repoctx — context: what does this change actually touch?
  • tieline — contracts: did the front end and back end quietly stop agreeing?
  • bouncer (this tool) — compliance: could you defend this to Ofcom?
  • aiglare — governance: where can the model do something you can't undo?

More at segunolumbe.com. static analysis, never the model.

来源:README.md,提交 89e5075

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.3.0最新Oct 13, 2026
  2. v0.2.0Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分