斜门 qq
停止你的AI编码代理 运输幻觉依赖和泄露秘密.
slopgate 是一个为气相编码时代而建的土生土长的安全门。 它扫描代理授权的 diffs 在此之前 他们着陆了 封锁那些不存在的软件包名称(slopsquatting) 和不应该承诺的证书.
状态 : MVP + 导入扫描 + 出错警告 + GitHub Action/SARIF + 代理承诺检测完成 – 252 测试为绿色, 发布到 npm22.13(使用内置)
node:sqlite模块——零本土依赖.
为什么会这样
AI编码代理快速写入代码. 他们也写 已损坏 代码快 :
- ~19.7% (中文(简体) ) aI生成的代码样本参考包 不存在 (Cloud Security Conference, 2026)——攻击者登记那些准确的幻觉取名来毒害下一个安装. 这是 挤压。 。 。 .
- Claude 代码协助 犯下暴露秘密 经常超过2× (GitGuardian, 2026年).
- CVES 正式归属于 AI 生成的代码跳出 2026年1月6起改为2026年3月35起。 。 。 .
现有工具不涵盖: gitleaks编号 :trufflehog 找到一般的秘密 但不知道依赖幻觉。 商业供应链平台虽然存在,但并不具有自定义性、自定义性或免费性. slopgate 完全填补了这个空白:一个命令,运行在你的钩子,阻断承诺.
它会做什么
| 层 | 接头 | 流动人口调查 |
|---|---|---|
| 秘密扫描 | API 密钥、 令牌、 私钥、 添加行中的 DB URL | ✅ |
| 📦 Slopsquat 防火墙 | Npm/ PyPI 中不存在的新解析器, 或存在但为 1–2 从通俗名称编辑的新解析器 | ✅ |
| 导入扫描 | 迷幻剂 import编号 :require 更改文件中的语句( JS/ TS + Python,别名- 意识) | ✅ |
| 代理人承诺检测 | 由编码代理撰写的旗帜( NameCo-Authored-By: Claude,"被赐与" | ✅ |
| GitHub 动作 | SARIF 关于 PR diff + 简要评论的说明 | ✅ |
快开始
# inside any repo
npx @al1prahman/slopgate init
# commit as usual — the hook does the rest
git commit -m "add fetch util"
多么糟糕的事业 看起来像:
$ git commit -m "add scraping deps"
slopgate: scanning 2 files, +34 -2 lines
✗ SECRET src/fetch.ts:12 anthropic-api-key ***... [BLOCK]
✗ SLOP requirements.txt:4 'reqeusts' not found on PyPI
→ did you mean 'requests'? [BLOCK]
⚠ SLOP src/scrape.py:8 'beaufitulsoup' is 91% similar to
'beautifulsoup4' (registered 12 days ago) [WARN]
commit blocked. 2 blocking findings.
--no-verify to override (don't).
退出代码 : 0 - 干净 1 警告(非封锁) 2 关闭.
配置
init 生成 .slopgate.yml数字 :
mode: block # block | warn | off
secrets:
enabled: true
ignore:
- '**/*.test.*'
deps:
enabled: true
ecosystems: [npm, pypi]
registries:
npm: https://registry.npmjs.org
pypi: https://pypi.org/pypi
custom-index: [] # internal registries to check first
allowlist: [] # trusted internal package names
quarantine: false # hold installs instead of blocking commit
typosquat:
enabled: true # warn on young look-alikes of popular packages
max-distance: 2 # edits from a popular name (0-5)
max-age-days: 90 # packages younger than this look seeded
cache:
positive-ttl-hours: 24 # how long an "exists" verdict is trusted
negative-ttl-minutes: 60 # how long a "missing" verdict is re-checked
python:
unmapped-imports: warn # import names with no known package mapping
imports:
enabled: true # scan import statements, not just manifests
agent:
enabled: true # flag agent-authored commits in range scans
手动扫描 :
slopgate scan --staged # what pre-commit runs
slopgate scan --range origin/main..HEAD
slopgate scan --json # machine-readable
slopgate scan --format sarif # SARIF 2.1.0 for code scanning upload
slopgate scan --mode warn # downgrade blocks to warnings for this run
slopgate scan --offline # cache-only; registry misses warn (fail-open)
slopgate cache # cache stats (path, entries, size)
slopgate cache clear # drop the local verdict cache
GitHub 动作
.github/workflows/slopgate.yml 在任何还款中:
name: slopgate
on: pull_request
permissions:
contents: read
pull-requests: write # for the summary comment
security-events: write # for the SARIF upload
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # the action needs the base ref for the diff
- uses: al1prahman/slopgate@v1
with:
mode: block # or warn — never fails the PR, just comments
调查结果 土地作为内部说明 github/codeql-action/upload-sarif)和作为对公关的一个高调的评论. 输入 : range, (中文(简体) ), mode, (中文(简体) ), comment, (中文(简体) ), token, (中文(简体) ), version。 。 。 .
代理授权犯罪
范围扫描( R)--range, 预推钩, GitHub 动作) 在范围中读取承诺信息, 并标出编码代理所撰写的信息 Co-Authored-By: Claude <[email protected]> 拖车 🤖 Generated with Claude Code 脚印,以及来自Cursor、Copilot、Codex、双子座、Devin和助手的等同物:
slopgate: scanned 3 file(s), +42 added line(s), 38ms
agent-authored commit (🤖 Generated with Claude Code) — extra scrutiny applied
⚠ dep.typosquat requirements.txt:7 [WARN]
"expres" exists but is 1 edit(s) from popular "express" and only 3 day(s) old — probable typosquat
1 warning(s). commit allowed.
信号是信息:它从不自行改变判决. 它告诉一个审查者,机器速度代码落在了这个diff中,所以上面的发现值得更仔细的审视. 完整标记列表运行在 --format json 在SARIF的地产袋里 分阶段扫描还没有承诺消息,因此Heuristic仅适用于范围扫描. 禁用为 agent: { enabled: false }。 。 。 .
承诺前框架
.pre-commit-hooks.yaml repo中的船只,所以框架用户不需要本地安装:
repos:
- repo: https://github.com/al1prahman/slopgate
rev: v1.0.1
hooks:
- id: slopgate # pre-commit: scans staged changes
- id: slopgate-push # pre-push: scans the pushed range
如何运作
git diff (staged / range / PR)
│
▼
added-lines only ──► secret detector ──► findings
│
├──► dependency extractor ──► registry existence check ──► similarity check
│ │ │
│ SQLite cache popular-package baseline
│
└──► import extractor ──► (alias table for Python) ──► same registry check
│
report ──► exit code (block / warn / pass)
三个设计规则保持了快而安静:
- 双镜 ——只扫描所添加的行;锁文件从不检查依赖性.
- 先缓存 ——每个注册裁定都以本地的SQLite来缓存;温暖的预承诺运行为 < 100ms.
- 注销登记失败 ——如果npm/PyPI无法到达,请警告而不是阻止你的承诺.
- 别忘了,别猜 —— Python 进口通过拼接别名表解决(
bs4→beautifulsoup4);没有条目的名称按原样并仅检查 警告( e) 当未知时, 因为地图可能只是缺失.
路线图
- 流动人口调查 ——接钩+秘密扫描+依赖存在检查(
package.json, (中文(简体) ),requirements.txt+ 伤寒警告、CLI、配置 - 单曲 ——导入扫描 (JS/Python) —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— 输入扫描 (JS/Python) —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— 进口扫描(JS/ Python) —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— -- —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— ——
.pre-commit-hooks.yaml - 页:1 —— 说
go.mod编号 :Cargo.toml编号 :Gemfile,注册-元数据风险评分,隔离模式,MCP服务器(承诺前的代理人自查)
捐款
公关欢迎。 光谱存在于 docs/ —— 说 01-design-doc.md 是产品PRD, 02-implementation-spec.md 是工程计划, 03-agent-build-handoff.md 是代理已准备好建立真相的来源.
git clone <repo>
cd slopgate
npm install
npm test