openclaw-secret-scanning-maintainer
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.mjsThe script enforces:
hide_secret=trueon all alert fetches (no plaintext secrets in stdout)mktempwith random UUIDs for all temp files-F body=@filefor all body uploads (no inline shell quoting)- Notification templates branched by location type
- Never prints
.secretor.bodyto stdout
Overall Flow
Supports single or multiple alerts. For multiple alerts, process in ascending order.
For each alert:
- Identify —
fetch-alert+fetch-contentto get metadata and body - Decide — Agent reads the body file, identifies whether plaintext secrets remain, and produces a redacted version only when needed
- Redact —
redact-body-if-neededfor issue/PR body; skip for comments (delete directly) - Purge —
delete-comment+recreate-commentfor comments; cannot purge body history - Notify —
notifyposts the right template per location type, unless the current issue/PR body is already redacted - Resolve —
resolvecloses the alert - Summary —
summaryprints formatted results
Step 1: Identify
# 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>'The fetch-content output includes:
body_file: path to temp file with full body contentauthor: who posted itissue_number/pr_number: where it isedit_history_count: number of existing editstype: location type for routing- For
discussion_comment, it also includescomment_node_id,discussion_node_id, andreply_to_node_idwhen the original comment was a reply.
Location type routing
| type | Flow |
| ----------------------------- | --------------------------------------------- |
| issue_comment | Comment: delete+recreate |
| pull_request_comment | Comment: delete+recreate |
| pull_request_review_comment | Comment: delete+recreate |
| discussion_comment | Discussion comment: delete+recreate (GraphQL) |
| issue_body | Body: redact in place |
| pull_request_body | Body: redact in place |
| commit | Notify only |
| _other_ | Skip and report |
Step 2: Decide (Agent)
The agent reads the body file from fetch-content output and:
- Identifies ALL secrets in the content (there may be more than the alert flagged)
- Determines whether any plaintext credential remains in the current body
- Replaces each remaining secret with
[REDACTED <secret_type>]— 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.
For issue_body and pull_request_body: if the current body has already been redacted by the author and no plaintext credential remains, do not post a public notification comment. This avoids creating a fresh public pointer to historical sensitive content. Record that redaction separately and use Step 6 to decide whether the evidence supports resolving the alert.
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
node secret-scanning.mjs redact-body-if-needed <issue|pr> <NUMBER> <current-body-file> <redacted-body-file> <result-file>Use the body_file from fetch-content as <current-body-file>. The command writes notify_required to <result-file> and only PATCHes the body when the redacted file differs from the current body.
Step 4: Purge Edit History
Comments — Delete and Recreate
For issue/PR comments:
# 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):
# 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 fetch-content output for discussion_comment includes comment_node_id and discussion_node_id for these commands. When the original discussion comment was a reply, it also includes reply_to_node_id; 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>