Community编程与开发github.com

OpenClaw 密钥扫描维护工具

对 OpenClaw GitHub 密钥扫描告警进行分类、编辑、清理和解决,适用于议题或拉取请求。

OpenClaw 密钥扫描维护工具 是什么?

OpenClaw 密钥扫描维护工具是一个仅供维护者使用的 AI 代理技能,用于处理来自 `https://github.com/openclaw/openclaw/security/secret-scanning` 的 GitHub 密钥扫描告警。该技能通过 `secret-scanning.mjs` 脚本执行所有机械操作,例如 API 调用和临时文件管理。其工作流程包括:识别告警的元数据和内容、由代理决定是否需要进行编辑(仅对议题/PR 正文进行编辑,评论则直接删除并重新创建)、通过通知模板向作者发送告警信息、根据证据选择适当的分辨率(如 `revoked` 或 `false_positive`)来解决告警,最后生成包含完整 URL 的 JSON 摘要。该工具严格禁止在输出中泄露任何密钥片段、告警 URL 或编辑历史,并确保所有公开通知用英文撰写。它支持多种位置类型,包括议题评论、PR 评论、讨论评论和正文,但不支持提交清理,仅能通知作者。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/.agents/skills/openclaw-secret-scanning-maintainer

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

OpenClaw 密钥扫描维护工具 是做什么的?

仅供维护者使用。 此技能需要仓库管理员/维护者权限才能编辑或删除其他用户的评论,以及解决密钥扫描告警。

在处理来自 https://github.com/openclaw/openclaw/security/secret-scanning 的告警时使用此技能。

语言规则: 所有通知评论和替换评论必须用英文撰写。

脚本

所有机械操作(API 调用、临时文件管理、安全强制措施)均由以下脚本处理:

$REPO_ROOT/.agents/skills/openclaw-secret-scanning-maintainer/scripts/secret-scanning.mjs

脚本强制要求:

  • 所有告警获取时设置 hide_secret=true(stdout 中不显示明文密钥)
  • 所有临时文件使用带随机 UUID 的 mktemp
  • 所有正文上传使用 -F body=@file(不使用内联 shell 引用)
  • 根据位置类型分支的通知模板
  • 绝不在 stdout 中打印 .secret 或 .body

整体流程

支持单个或多个告警。对于多个告警,按升序处理。

对于每个告警:

  1. 识别 — 使用 fetch-alert + fetch-content 获取元数据和正文
  2. 决策 — 代理读取正文文件,识别是否仍包含明文密钥,并在必要时生成编辑版本
  3. 编辑 — 对议题/PR 正文使用 redact-body-if-needed;对于评论则跳过(直接删除)
  4. 清除 — 对评论使用 delete-comment + recreate-comment;正文历史无法清除
  5. 通知 — 根据位置类型通过 notify 发布相应模板,除非当前议题/PR 正文已编辑
  6. 解决 — 使用 resolve 关闭告警
  7. 摘要 — 使用 summary 打印格式化结果

步骤 1:识别

# 列出所有打开状态的告警
node secret-scanning.mjs list-open

# 获取特定告警的元数据 + 位置信息
node secret-scanning.mjs fetch-alert <编号>

# 获取每个位置的内容(将正文保存到临时文件)
node secret-scanning.mjs fetch-content '<位置-json>'

fetch-content 输出包括:

  • body_file:包含完整正文内容的临时文件路径
  • author:发布者
  • issue_number / pr_number:所在位置
  • edit_history_count:现有编辑次数
  • type:用于路由的位置类型
  • 对于 discussion_comment,还包括 comment_node_id、discussion_node_id,以及当原评论是回复时的 reply_to_node_id

位置类型路由

type流程
issue_comment评论:删除+重新创建
pull_request_comment评论:删除+重新创建
pull_request_review_comment评论:删除+重新创建
discussion_comment讨论评论:删除+重新创建 (GraphQL)
issue_body正文:原地编辑
pull_request_body正文:原地编辑
commit仅通知
其他跳过并报告

步骤 2:决策(代理)

代理读取 fetch-content 输出的正文文件,并:

  1. 识别内容中所有密钥(可能多于告警标记的密钥)
  2. 判断当前正文中是否仍有明文凭证
  3. 用 [REDACTED <secret_type>] 替换每个剩余密钥——不允许保留部分值、前缀或后缀
  4. 将编辑后的内容保存到新的临时文件

这是唯一需要语义理解的步骤。其他都是机械操作。

对于 issue_body 和 pull_request_body:如果当前正文已被作者编辑且无剩余明文凭证,不要发布公开通知评论。这样可以避免创建指向历史敏感内容的新的公开引用。单独记录编辑结果,并使用步骤 6 判断证据是否支持解决告警。

步骤 3:编辑

对于评论(issue_comment / PR 评论)

不要编辑。 直接跳到步骤 4(删除+重新创建)。在 DELETE 之前进行 PATCH 会创建不必要的编辑历史版本。

对于 issue_body / pull_request_body

node secret-scanning.mjs redact-body-if-needed <issue|pr> <编号> <当前正文文件> <编辑后正文文件> <结果文件>

使用 fetch-content 的 body_file 作为 <当前正文文件>。该命令将 notify_required 写入 <结果文件>,并且仅当编辑后的文件与当前正文不同时,才 PATCH 正文。

步骤 4:清除编辑历史

评论——删除并重新创建

对于议题/PR 评论:

# 删除原评论(所有编辑历史消失)
node secret-scanning.mjs delete-comment <评论ID>

# 用编辑后的内容重新创建评论
node secret-scanning.mjs recreate-comment <议题编号> <正文文件>

对于讨论评论(使用 GraphQL):

# 删除原评论
node secret-scanning.mjs delete-discussion-comment <评论节点ID>

# 用编辑后的内容重新创建评论
node secret-scanning.mjs recreate-discussion-comment <讨论节点ID> <正文文件> [回复目标节点ID]

fetch-content 输出中的 discussion_comment 类型包含 comment_node_id 和 discussion_node_id 用于这些命令。如果原讨论评论是回复,输出还包括 reply_to_node_id;请传递该可选的第三个参数,以便编辑后的替换内容保留在原线程中。

重新创建的评论应遵循以下格式:

> **注意:** @<AUTHOR> 的原评论因密钥泄露已被删除。以下是原内容的编辑版本。

---

<编辑后的原始内容>

issue_body / pull_request_body——无法清除编辑历史

编辑操作会创建一个包含编辑前明文内容的编辑历史版本。该版本无法通过 API 清除。

不要公开建议作者删除/重新创建议题或关闭/重新打开 PR。这可能会引起对历史内容的关注。清除指导应仅限维护者。

仅输出到维护者终端(绝不要在公开评论中输出):

⚠️ 议题/PR 正文编辑历史仍包含明文密钥。
请联系 GitHub 支持进行清除:https://support.github.com/contact
请求清除议题/PR #{编号} 的 userContentEdits。

关键: 绝不要在公开评论或解决方案评论中提及编辑历史或“已编辑”按钮。

提交

无法清理。通知作者删除分支或强制推送(针对未合并的 PR)。

步骤 5:通知

node secret-scanning.mjs notify <目标> <作者> <位置类型> <密钥类型> [回复目标节点ID|正文编辑结果文件]
  • 对于非讨论类型,<目标> 是议题/PR 编号。
  • 对于 discussion_comment,<目标> 是 fetch-content 返回的 discussion_node_id。
  • 对于回复类型的 discussion_comment 位置,传递 fetch-content 中的可选 reply_to_node_id,以便通知保留在同一线程中。
  • 对于 issue_body 和 pull_request_body,传递 redact-body-if-needed 输出的 <结果文件>。当 notify_required 为 false 时,脚本会跳过通知,并且没有此文件时会拒绝正文通知。

密钥类型用逗号分隔:"Discord Bot Token,Feishu App Secret"

脚本选择正确的模板:

  • 评论类型:“您的评论……已删除并替换”
  • 正文类型:“您的议题/PR 描述……已原地编辑”
  • 提交:“您提交的代码”

对于 issue_body 和 pull_request_body,仅当当前正文仍包含明文且由维护者编辑时才通知。如果用户已编辑当前正文,则跳过通知并继续步骤 6。

步骤 6:解决

node secret-scanning.mjs resolve <告警编号> <分辨率> [评论]

选择基于证据和维护者权限的明确分辨率:

  • revoked:凭证所有者或签发者已确认撤销。
  • false_positive:检测被确认为误报。
  • used_in_tests:凭证已被确认为用于测试。
  • wont_fix:授权维护者已接受风险并决定不修复;在评论中记录该决定。

编辑操作和请求轮换凭证并不能确认为撤销。如果没有确凿的分辨率依据,则保持告警打开状态,并分别报告编辑和通知的结果。该命令没有默认分辨率,并且仅在提供分辨率评论时添加。

步骤 7:摘要

处理完成后,创建一个 JSON 结果文件并传递给摘要命令:

node secret-scanning.mjs summary /tmp/results.json

脚本输出一个由 ---BEGIN SUMMARY--- 和 ---END SUMMARY--- 分隔的块。您必须逐字输出这两个标记之间的内容给用户。不要重新措辞、重新格式化、缩写或创建自己的摘要。 脚本已包含每个告警和位置的完整 URL。

JSON 格式:

[
  {
    "number": 72,
    "secret_type": "Discord Bot Token",
    "location_label": "Issue #63101 comment",
    "location_url": "https://github.com/openclaw/openclaw/issues/63101#issuecomment-xxx",
    "actions": "Deleted+Recreated+Notified",
    "history_cleared": true
  }
]

对于不支持的类型,添加 "skipped": true, "unsupported_type": "<type>"。

安全规则

  • 代理读取内容、识别密钥、生成编辑内容。 脚本处理所有 API 调用。
  • 绝不在公开评论、编辑标记或终端输出中包含任何密钥片段。
  • 绝不在公开评论中包含告警 URL 或编号。
  • 对于评论,跳过 PATCH——直接 DELETE + 重新创建。
  • 绝不在任何公开内容中提及编辑历史、“已编辑”按钮或提交 SHA。
  • 删除任何评论前需确认。
  • 一次处理一个告警,除非用户要求批量处理。
  • 所有公开评论使用英文。
  • 跳过不支持的位置类型并在摘要中报告。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相关技能