AxioRank/hermes-plugin

GitHub: AxioRank/hermes-plugin

AxioRank/hermes-plugin 是一款为 Hermes Agent 框架提供实时安全评分与拦截能力的 AI Agent 安全网关插件。

Stars: 0 | Forks: 0

# AxioRank 的 Hermes 安全网关 [![PyPI](https://img.shields.io/badge/PyPI-v0.1.0-5852F6?logo=pypi&logoColor=white)](https://pypi.org/project/hermes-axiorank/) [![Python](https://img.shields.io/badge/python-3.9%2B-3776AB?logo=python&logoColor=white)](https://pypi.org/project/hermes-axiorank/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/AxioRank/hermes-plugin/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-5852F6?logo=opensourceinitiative&logoColor=white)](LICENSE) 通过 [AxioRank](https://axiorank.com)(AI agent 的安全网关)路由每一个 [Hermes](https://github.com/NousResearch/hermes-agent) agent tool call。它会对 tool call 和 tool 结果进行安全评分,检测实时密钥泄露、prompt 注入、破坏性操作、PII 以及高风险的外发请求,在模型对话中注入实时防护策略,并能在危险操作执行前进行硬拦截。 无需 API key 即可离线工作(使用本地检测器)。添加 `AXIORANK_API_KEY` 还可以将判定结果上报至托管网关,应用工作区策略,将会话记录至中央审计日志,并生成带有签名的、可离线验证的 Coding Session Seal。 ## 功能特性 - **Agent 可调用的防护工具:** `axiorank_inspect`(对命令、内容或 tool call 进行评分)、`axiorank_scan_mcp`(在信任外部 MCP server 或 agent card 之前进行验证)、`axiorank_verify`(离线验证审计凭证)。 - **注入每个会话的防护栏:** 常驻策略横幅,以及当 tool 结果被标记时发出的一次性污染警告,确保被投毒的网页或 MCP 响应无法悄无声息地操纵 agent。 - **审计与 sealing:** 单次会话追踪、实时风险统计,并在退出时生成带签名的 Coding Session Seal(使用密钥)。 - **可选的硬拦截:** `pre_tool_call` shell hook 可在危险操作执行前予以拒绝,只需一条命令即可安装。 - **内置技能**,可教导 agent 自我对高风险操作进行门控。 ## 安装说明 ### 使用 pip(推荐) ``` pip install hermes-axiorank ``` Hermes 会在下次启动时自动发现该插件。启用插件: ``` hermes plugins enable axiorank ``` ### 目录放置 将插件复制到你的 Hermes 插件目录: ``` mkdir -p ~/.hermes/plugins/axiorank cp -R src/hermes_axiorank/* ~/.hermes/plugins/axiorank/ pip install 'axiorank>=0.17' # the detection engine hermes plugins enable axiorank ``` ## 使用说明 启动 Hermes。你应该会在工具列表中看到 `axiorank: axiorank_inspect, axiorank_scan_mcp, axiorank_verify`。随时检查状态: ``` /axiorank status ``` Agent 会自行调用防护工具(由内置技能引导)。如需显式加载技能: ``` skill_view("axiorank:secure-tool-use") ``` ## 托管模式(可选) 设置工作区 API key,以上报至托管网关并启用会话 sealing: ``` export AXIORANK_API_KEY=axr_live_... # 可选,默认为 https://app.axiorank.com export AXIORANK_BASE_URL=https://app.axiorank.com ``` 从 [app.axiorank.com](https://app.axiorank.com) 获取 key。 ## 强制执行(可选) Python 插件 hook 会监控 tool call,但无法在执行过程中进行拦截。若要在危险操作运行前进行硬拦截,请安装 shell hook: ``` hermes axiorank init # guards terminal, write_file, file_edit, patch, web_fetch, mcp__* hermes axiorank init --tools all # guard every tool hermes axiorank init --api-key axr_live_... # also save the key to ./.env hermes axiorank init --print # print the config snippet instead of editing ``` 这会向 `~/.hermes/config.yaml` 添加一个 `pre_tool_call` hook,执行 `axiorank-hermes-guard`。它会拒绝被检测器标记为高风险的调用,在其他情况下则保持静默,因此不会影响 Hermes 自身的权限流程。 ## 配置 该插件具有合理的默认值,无需额外配置即可运行。环境变量: | 变量 | 含义 | | --- | --- | | `AXIORANK_API_KEY` | 用于托管上报和会话 sealing 的工作区密钥。可选。 | | `AXIORANK_BASE_URL` | 网关 base URL。默认为 `https://app.axiorank.com`。 | | `AXIORANK_MODE` | 用于 shell 防护的 `enforce` 或 `monitor` 模式。安装后默认为 `enforce`。 | | `AXIORANK_HERMES_GUARD_DISABLE_REMOTE` | 强制 shell 防护仅进行本地评分。 | | `AXIORANK_HERMES_GUARD_TIMEOUT_MS` | shell 防护的托管调用超时时间。 | 安全态势(模式、拒绝阈值、拦截类别、结果检查、context 注入)也可通过宿主插件 config 进行设置。默认值:会话内 hook 采用监控态势(用于观察和注入 context)、拒绝阈值为 75、审查区间从 50 开始,拦截类别包括 `secret, destructive, malware, injection`。 ## 工作原理 - 评分默认离线且无需密钥,使用 [`axiorank`](https://pypi.org/project/axiorank/) Python SDK 的 AxioRank 检测器。 - 配置 key 后,每次调用也会上报至 `POST /api/gateway/tool-call`;中央决策只会使本地策略更加严格。 - `pre_llm_call` hook 会返回 context 并由 Hermes 将其附加到用户对话中(绝不附加到 system prompt 中),从而确保护栏与用户消息保持一致,且不会破坏 prompt 缓存。 ## License MIT
标签:Python, 安全网关, 提示注入防护, 无后门, 逆向工具, 零日漏洞检测