跳到正文
Hacker News-首页· agybay_07·· 2 小时前精选AI 评分79

Stroq 发布:用于审查编码智能体行为与凭证流向的本地安全平台

Show HN: Stroq – a local audit of what your coding agent did and why

AI 导读

Stroq 是一个用于 AI 编码智能体的本地安全平台,支持 Claude Code、Cursor、Codex CLI 等工具。它通过本地钩子和会话重放功能,检查智能体读取的文本与执行的命令,审计密钥泄露风险并拦截已知攻击,全程无需账号且无遥测。

推荐理由

原文提供了本地安全平台的完整命令和架构边界,读者可以据此评估它在编码智能体审计与凭证保护上的实际落地方式。

正文 · AI 翻译

Stroq 读取你自己的 Claude Code 和 Codex 会话,并展示有多少命令来自你的智能体读到的文本,以及有哪些密钥离开了你的机器。

The Stroq card in a terminal, on an example machine: Hoo, an orange pixel owl, beside the counts for 30 days of agent sessions (105 commands your agent ran, 1 that came from text it read, 1 key that left the machine, 1 repo that runs code as soon as an agent opens it) and three moments worth a look, each with a stroq show line

一个示例:包含虚构会话、密钥和主机的虚构机器。Hoo 是 Stroq 的猫头鹰。你的卡片会展示你自己的会话。

npx @stroq/cli

它会读取你最近 30 天的会话、你的密钥文件以及你的智能体工作过的文件夹;打印密钥名称,绝不打印密钥值;除了在 ~/.stroq 下写入一个小缓存外不写入任何内容;且不发送任何数据。无需账号,没有遥测。

npx @stroq/cli            a card of your own sessions, like the one above
npx @stroq/cli init       stop it next time: guard your agent
npx @stroq/cli why        why an action was stopped
npx @stroq/cli attack     watch Stroq stop 36 known attacks, in a sandbox
npx @stroq/cli uninstall  remove Stroq

卡片上的每个时刻都有一行 stroq show 用于打印其背后的证据(npx @stroq/cli show 1)。stroq help --all 列出了其他命令。需要 Node.js 22 或更高版本。Apache-2.0。

超越卡片

Stroq 是针对 AI 编程智能体(Claude Code、Cursor、Codex CLI 等)的本地安全平台。其钩子(hooks)会在每个工具调用运行前对其进行评估。它们会拒绝 curl | sh 以及携带你机器上已知秘密的出站调用,并且当命令重复了智能体读到的文本时会首先向你询问,同时指明该文本。控制台会显示哪些智能体实际调用了 Stroq,以及每一项决策及其原因。你之前进行的会话也可以进行检查,无需安装任何东西。

npx @stroq/cli console        # the console: a private page on 127.0.0.1
npx @stroq/cli replay --all   # your Claude Code sessions of the last 30 days against the policy; no hooks needed
npx @stroq/cli sent           # did your agent pass your keys on? key names, never values
npx @stroq/cli init           # hook into your agent and guard the next session

Stroq console, Live screen: the last 8 recorded actions, 4 allowed, 1 asked you, 2 denied, 1 flagged, and a denied action opened into what the agent read, what it did, the decision and the rule

一台虚构的机器:包含虚构的会话、密钥和主机。未执行任何操作。

控制台

第五个屏幕是规则:在不运行操作的情况下试用它、通过预览和测试开启规则、带撤销功能的历史记录,以及规则参考。已连接意味着 Stroq 的钩子位于智能体的设置中,并不代表智能体调用了它们:测试钩子和实时功能展示了这一点。

来自 0.30.0 之前版本的构建屏幕截图,读取了一台虚构的机器:包含虚构的会话、密钥和主机。未执行任何操作。

npx @stroq/cli console                            # a private page on 127.0.0.1
npx @stroq/cli console --workspace /path/to/repo  # the project it should look at

打开它打印的完整链接:它携带了一个每次控制台启动时都全新的密钥。控制台会读取 Stroq 已经在这台机器上记录的内容。它仅在你确认更改的预览后才会修改智能体的设置或 Stroq 的策略;你运行的检查保存在 ~/.stroq 下。

它只监听 127.0.0.1,不需要账号且没有遥测。其中没有任何东西会启动你的智能体:测试钩子离线运行一次钩子。从控制台添加钩子需要 macOS 或 Linux;在 Windows 上请使用 stroq init。详细信息和限制:控制台指南。

从源码检出:

pnpm install --frozen-lockfile
pnpm --dir console install --ignore-workspace --frozen-lockfile
pnpm platform:build
pnpm platform --workspace /path/to/repo

在终端中

stroq replay --last on a staged session: a GitHub issue the agent read scores SUSPECT, and two later commands traced to it would be denied, curl to sh by deny-encoded-exec 18 s later and npx of a package named in the issue by deny-origin-suspect 54 s later; four other actions would be allowed

0.29.0 CLI 在同一故事的虚构 Claude Code 转录本上的输出;路径已被缩短。

stroq replay 读取智能体自己的转录本,因此它适用于安装 Stroq 之前的会话:智能体读取了哪些内容,以及随后的哪些操作是由此产生的。--all 会遍历过去 30 天的每一个会话,并指出应该打开哪一个。没有任何运行,也没有发送任何内容;裁决结果是当今的策略,而不是当时发生的事情的记录。

stroq sent 将你的 Claude Code、Codex CLI 和 Cursor 会话与你机器上的凭据进行比较,并说明每个密钥的去向:发送给其他公司、可能已发送、被 AI 看到、与其自身服务一起使用,或者在运行前被阻止。它只打印名称和来源,绝不打印值。从会话秘密扫描演练开始(还没有会话?使用虚构密钥试一试)。

stroq sent 发现的结果是什么样的

虚构的密钥,构建的 CLI 的输出,已裁剪:

stroq sent: did your AI agent pass your keys on?

6 of your 6 keys appear in your agent sessions: 2 sent to another company, 1 maybe sent, 1 seen by the AI, 1 used with its own service, 1 blocked before it ran.

Checked 3 sessions (Claude Code 2, Codex 1), 2026-10-02 to 2026-10-19.
Compared with 6 keys: ~/.aws/credentials, ~/.npmrc, ~/work/shop/.env, ~/work/api/.env.

SENT TO ANOTHER COMPANY: rotate these today (2)
 1. STRIPE_SECRET_KEY  from ~/work/shop/.env
    went to  collector.example, in a curl command
    when     2026-10-11 14:02 UTC · Claude Code · ~/work/shop
    do       revoke it at https://dashboard.stripe.com/apikeys, then update ~/work/shop/.env

SEEN BY THE AI: your agent's model saw these keys (1)
 4. aws_secret_access_key  from ~/.aws/credentials
    seen in  the output of a Read of ~/.aws/credentials
    when     2026-10-02 09:42 UTC · Claude Code · ~/work/api
    note     Not ruled out: 2 later commands in that session could reach the network.
    do       your agent's model saw it; rotate it if that matters: https://console.aws.amazon.com/iam/home#/security_credentials

Stroq names a send only when it sees the key in the command that sent it. A script, a file or a variable can carry a key out without showing it.

stroq attack 在一次性主目录中针对你的策略运行 36 项攻击(来自公开报告和合成单元):在 0.30.0 版本中,15 项被拒绝,21 项被询问,0 项通过。

它涵盖的范围与它的局限

  • 每次操作前。为 Claude Code、Cursor、Codex、Copilot CLI、Windsurf 和 Antigravity 提供原生钩子(hooks),为 OpenClaw 提供插件,以及一个 stdio MCP 代理。包含已知密钥的出站调用可以被拒绝;出处(provenance)将后续操作与其重复的工具输出关联起来。在 Claude Code 中,关于从智能体读取的文本中复制的值的问题,每个会话询问一次,除非会话已在后台启动了某些内容。
  • 事后。replay 和 sent 读取本地会话记录,包括安装 Stroq 之前会话的记录。旧的、轮换过的或未知的价值可能会被漏掉,而未在命令中显示的密钥可能仍会留在脚本、文件或变量中。本地记录匹配本身并不能证明已交付给模型提供商。
  • 本地。钩子不会发起出站网络调用;旧版 Task Lock 运行的钩子仅与其本地父控制器通信。无遥测技术。
  • 限制。钩子只能看到主机发送的内容,并且这会因智能体和版本而异。匹配是文本级别的,因此模型从头编写的命令无法追溯到来源。它是一个过滤器,而不是一个沙盒。在依赖实时钩子之前,请阅读 集成限制。

文档

贡献者

感谢所有贡献代码、报告错误、测试智能体集成以及完善文档的人 ❤️

Contributors

stroq.dev

来源:Hacker News-首页 · github.com