OpenClaw Secret Scanning Maintainer
Maintainer-only. This skill requires repo admin / maintainer permissions to edit or delete other users' comments and resolve secret scanning alerts.
Use this skill when processing alerts from
https://github.com/openclaw/openclaw/security/secret-scanning
.
Language rule: All notification comments and replacement comments MUST be written in English.
Script
All mechanical operations (API calls, temp file management, security enforcements) are handled by:
$REPO_ROOT/.agents/skills/openclaw-secret-scanning-maintainer/scripts/secret-scanning.mjs
The script enforces:
- on all alert fetches (no plaintext secrets in stdout)
- with random UUIDs for all temp files
- for all body uploads (no inline shell quoting)
- Notification templates branched by location type
- Never prints or to stdout
Overall Flow
Supports single or multiple alerts. For multiple alerts, process in ascending order.
For each alert:
- Identify — + to get metadata and body
- Decide — Agent reads the body file, identifies all secrets, produces redacted version
- Redact — for issue/PR body; skip for comments (delete directly)
- Purge — + for comments; cannot purge body history
- Notify — posts the right template per location type
- Resolve — closes the alert
- Summary — prints formatted results
Step 1: Identify
bash
# List all open alerts
node secret-scanning.mjs list-open
# Fetch specific alert metadata + locations
node secret-scanning.mjs fetch-alert <NUMBER>
# Fetch content for each location (saves body to temp file)
node secret-scanning.mjs fetch-content '<location-json>'
- : path to temp file with full body content
- : who posted it
- / : where it is
- : number of existing edits
- : location type for routing
- For , it also includes , , and when the original comment was a reply.
Location type routing
| type | Flow |
|---|
| Comment: delete+recreate |
| Comment: delete+recreate |
pull_request_review_comment
| Comment: delete+recreate |
| Discussion comment: delete+recreate (GraphQL) |
| Body: redact in place |
| Body: redact in place |
| Notify only |
| other | Skip and report |
Step 2: Decide (Agent)
The agent reads the body file from
output and:
- Identifies ALL secrets in the content (there may be more than the alert flagged)
- Replaces each secret with — no partial values, no prefix/suffix
- Saves the redacted content to a new temp file
This is the only step that requires semantic understanding. Everything else is mechanical.
Step 3: Redact
For comments (issue_comment / PR comments)
Do NOT redact. Skip directly to Step 4 (delete + recreate). PATCHing before DELETE creates an unnecessary edit history revision.
For issue_body / pull_request_body
bash
node secret-scanning.mjs redact-body <issue|pr> <NUMBER> <redacted-body-file>
Step 4: Purge Edit History
Comments — Delete and Recreate
For issue/PR comments:
bash
# Delete original (all edit history gone)
node secret-scanning.mjs delete-comment <COMMENT_ID>
# Recreate with redacted content
node secret-scanning.mjs recreate-comment <ISSUE_NUMBER> <body-file>
For discussion comments (uses GraphQL):
bash
# Delete original
node secret-scanning.mjs delete-discussion-comment <COMMENT_NODE_ID>
# Recreate with redacted content
node secret-scanning.mjs recreate-discussion-comment <DISCUSSION_NODE_ID> <body-file> [REPLY_TO_NODE_ID]
The
output for
includes
and
for these commands. When the original discussion comment was a reply, it also includes
; pass that optional third argument so the redacted replacement stays in the original thread.
The recreated comment should follow this format:
> **Note:** The original comment by @<AUTHOR> has been removed due to secret leakage. Below is the redacted version of the original content.
---
<redacted original content>
issue_body / pull_request_body — Cannot Purge
Editing creates an edit history revision with the pre-edit plaintext. This cannot be cleared via API.
Output to maintainer terminal only (never in public comments):
⚠️ Issue/PR body edit history still contains plaintext secrets.
Contact GitHub Support to purge: https://support.github.com/contact
Request purge of issue/PR #{NUMBER} userContentEdits.
CRITICAL: Do NOT mention edit history or the "edited" button in any public comment or resolution_comment.
Commits
Cannot clean. Notify author to delete branch or force-push (for unmerged PRs).
Step 5: Notify
bash
node secret-scanning.mjs notify <TARGET> <AUTHOR> <LOCATION_TYPE> <SECRET_TYPES> [REPLY_TO_NODE_ID]
- For non-discussion types, is the issue/PR number.
- For , is the returned by .
- For reply-style locations, pass the optional from so the notification stays in the same thread.
Secret types are comma-separated:
"Discord Bot Token,Feishu App Secret"
The script picks the right template:
- comment types: "your comment … removed and replaced"
- body types: "your issue/PR description … redacted in place"
- commit: "code you committed"
Step 6: Resolve
bash
node secret-scanning.mjs resolve <ALERT_NUMBER>
# or with custom resolution:
node secret-scanning.mjs resolve <ALERT_NUMBER> revoked "Custom comment"
Resolution is
by default. As maintainers we cannot control whether users rotate — our responsibility is to redact + notify. The
means "this secret should be considered leaked", not "I confirmed it was revoked".
Step 7: Summary
After processing, create a JSON results file and pass it to the summary command:
bash
node secret-scanning.mjs summary /tmp/results.json
The script outputs a block delimited by
and
.
You MUST output the content between these markers verbatim to the user. Do NOT rephrase, reformat, abbreviate, or create your own summary. The script already includes full URLs for every alert and location.
The JSON format:
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
}
]
For unsupported types, add
"skipped": true, "unsupported_type": "<type>"
.
Safety Rules
- Agent reads content, identifies secrets, produces redaction. Script handles all API calls.
- Never include any portion of a secret in public comments, redaction markers, or terminal output.
- Never include alert URLs or numbers in public comments.
- For comments, skip PATCH — go directly to DELETE + recreate.
- Never mention edit history, "edited" button, or commit SHAs in any public content.
- Ask for confirmation before deleting any comment.
- One alert at a time unless user requests batch.
- All public comments in English.
- Skip unsupported location types and report in summary.