@al1prahman/slopgate

中文文档
1.0.9发布于 2026/11/04MITES Module近 30 天下载 1853

Git-native 安全门 阻止AI编码代理 航运 幻觉依赖和泄露秘密

中文使用文档
文档目录11 节
  1. 为什么会这样
  2. 它会做什么
  3. 快开始
  4. 配置
  5. GitHub 动作
  6. 代理授权犯罪
  7. 承诺前框架
  8. 如何运作
  9. 路线图
  10. 捐款
  11. 许可证

斜门 qq

停止你的AI编码代理 运输幻觉依赖和泄露秘密.

slopgate 是一个为气相编码时代而建的土生土长的安全门。 它扫描代理授权的 diffs 在此之前 他们着陆了 封锁那些不存在的软件包名称(slopsquatting) 和不应该承诺的证书.

CI npm version License: MIT

状态 : 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)

三个设计规则保持了快而安静:

  1. 双镜 ——只扫描所添加的行;锁文件从不检查依赖性.
  2. 先缓存 ——每个注册裁定都以本地的SQLite来缓存;温暖的预承诺运行为 < 100ms.
  3. 注销登记失败 ——如果npm/PyPI无法到达,请警告而不是阻止你的承诺.
  4. 别忘了,别猜 —— 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

许可证

麻省理工学院

版本与发布记录

@al1prahman/slopgate 共发布 11 个版本,首次发布于 2026/11/03;过去 12 个月发布了 11 个版本。

版本发布日期距今
1.0.9latest2026/11/044 天前
1.0.82026/11/035 天前
1.0.72026/11/035 天前
1.0.62026/11/035 天前
1.0.52026/11/035 天前
1.0.42026/11/035 天前

关于 @al1prahman/slopgate 的常见问题

@al1prahman/slopgate 是什么?

Git-native 安全门 阻止AI编码代理 航运 幻觉依赖和泄露秘密

如何安装 @al1prahman/slopgate?

在项目目录运行 npm install @al1prahman/slopgate,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 slopgate,可以用 npx slopgate 直接运行。

@al1prahman/slopgate 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/al1prahman__slopgate 是否存在。

@al1prahman/slopgate 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@al1prahman/slopgate 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@al1prahman/slopgate 可以商用吗?

@al1prahman/slopgate 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@al1prahman/slopgate 的下载量有多少?

根据 npm 官方下载统计,@al1prahman/slopgate 在 2026/10/06 – 2026/11/04 这 30 天内被下载 1,853 次,日均约 62 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@al1prahman/slopgate 还在维护吗?

最新版本 1.0.9 发布于 2026/11/04(4 天前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。