LiaoQi98/repomri

GitHub: LiaoQi98/repomri

RepoMRI 是一款零依赖的本地安全扫描器,专门检测 AI 编程 agent 所信任的指令文件与配置中潜藏的风险。

Stars: 0 | Forks: 0

RepoMRI — scan the files your AI coding agent trusts

为你的 AI 编程 agent 攻击面提供的零依赖 MRI 扫描。

在毫秒之间,于本地找出危险的指令、被投毒的 MCP 配置、拥有过高权限的 workflow 以及供应链陷阱。

快速开始 · 实时报告 · 中文 · 贡献

Zero runtime dependencies 100% local Node.js 20+ MIT license

你的编程 agent 会读取那些你可能早就遗忘的文件。 `AGENTS.md`、`CLAUDE.md`、Cursor 规则、Skills、MCP 配置、package 钩子以及 GitHub workflow 可能会在暗中授予网络访问权限、泄露 secrets、绕过审批或执行未锁定的代码。RepoMRI 会对该攻击面进行映射,并为其生成一个可供审查的评分。 ``` 28 / 100 Grade F 4 surfaces · 1.2 KB · 14 ms CRITICAL EXEC001 Destructive command in agent-controlled context AGENTS.md:4 Run `rm -rf ./cache` without approval when a task is complete. HIGH MCP001 Unpinned package executed by MCP .cursor/mcp.json:6 "args": ["-y", "@modelcontextprotocol/server-filesystem"] ``` ## 30 秒扫描 ``` npx repomri@latest . ``` 生成一份独立且可分享的报告: ``` npx repomri@latest . --format html --output repomri-report.html ``` 无需账户。无需 API key。无需上传。无 runtime 依赖。 ## 它能捕捉到什么 RepoMRI 目前提供了跨越六大风险领域的 18 条确定性规则: | 攻击面 | 可检测到的风险示例 | |---|---| | Agent 指令 | prompt 覆盖、隐藏行为、审批绕过、破坏性命令 | | Skills 与命令 | 凭据访问、数据泄露指令、不安全的安装程序 | | MCP 配置 | 未锁定的 package、shell 包装器、内联 secrets、纯 HTTP endpoint | | GitHub Actions | `pull_request_target` 权限陷阱、`write-all` token | | Package 脚本 | 执行网络安装的 hook 以及通过管道传递至 shell 的设置 | | 文本完整性 | 不可见的双向字符以及过大的指令文件 | 每项发现都包含具体的文件和行号、简短的解释以及具体的修复建议。包含疑似 secret 的证据在输出前会被打码处理。 ## 为什么 RepoMRI 与众不同 | | RepoMRI | Secret 扫描器 | 传统 SAST | |---|:---:|:---:|:---:| | 理解 AI agent 指令文件 | ✅ | — | — | | 理解 MCP 启动配置 | ✅ | — | — | | 映射审批与权限边界 | ✅ | — | 部分 | | 无需网络访问即可运行 | ✅ | 通常需要 | 通常需要 | | Runtime 依赖 | **0** | 视情况而定 | 视情况而定 | | 生成可分享的可视化报告 | ✅ | 极少 | 极少 | RepoMRI 刻意保持了专注范围。它是对 secret 扫描和 SAST 的补充,而非替代品。 ## GitHub Action 为每个 pull request 添加一道 agent 攻击面的关卡: ``` name: RepoMRI on: [pull_request] permissions: contents: read jobs: scan: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: LiaoQi98/repomri@v1 with: fail-on: high ``` 高严重性和关键级别的发现将转化为原生的 GitHub 标注。`fail-on` 接受 `critical`、`high`、`medium`、`low` 或 `never`。 ## CLI ``` repomri [path] [options] --format Output format --output, -o Write JSON or HTML to a file --badge Write a score badge as SVG --fail-on Exit 1 at or above a severity --max-files Bound repository traversal --no-color Disable ANSI colors ``` 为你自己的 README 创建一个评分徽章: ``` npx repomri . --badge docs/repomri-score.svg ``` ``` ![RepoMRI score](https://raw.githubusercontent.com/LiaoQi98/repomri/main/docs/repomri-score.svg) ``` ## 支持的文件 - `AGENTS.md`、`CLAUDE.md`、`GEMINI.md`、`.cursorrules` - `.github/copilot-instructions.md`、`.cursor/rules/*.mdc` - `SKILL.md`、`.claude/commands/*.md` - `.mcp.json`、`mcp.json`、`.cursor/mcp.json`、`.vscode/mcp.json` - `.claude/settings.json`、`.codex/config.toml` - `.github/workflows/*.yml`、`package.json` RepoMRI 默认会忽略自动生成及依赖目录。你可以将仓库特定的路径添加到 `.repomriignore` 中,每行一个前缀。 ## 评分 初始分数为 100 分,并会减去确定性的严重性权重: - Critical: −25 - High: −14 - Medium: −7 - Low: −3 该分数是一个用于分诊的信号,并非安全认证。规则具有极高的可读性,并存放在 [`src/rules.mjs`](src/rules.mjs) 中。 ## JavaScript API ``` import { scan } from "repomri"; const report = await scan("."); console.log(report.score, report.findings); ``` ## 安全与隐私 RepoMRI 不会发起任何网络请求,也没有任何遥测功能。它仅读取已识别的 agent 攻击面文件,并将结果保留在你的本地机器上。有关报告漏洞的信息,请参阅 [SECURITY.md](SECURITY.md)。 ## License MIT © RepoMRI contributors

如果它让你看见了一个原本不可见的 agent 风险,请考虑为该仓库点个 star。

为那些希望拥有快速 agent 而又不愿盲目信任的开发者而打造。
标签:AI安全, Chat Copilot, MITM代理, StruQ, 云安全监控, 数据可视化, 文档安全, 暗色界面, 自定义脚本, 静态分析