Pre Publish Security
简介
Pre Publish Security
原始描述
Multi-layered security audit system for GitHub/ClawHub releases. Prevents credential leaks, detects vulnerabilities, validates documentation. Frequency-aware...
通过你的 Agent 添加
安装目录:pre-publish-security/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: pre-publish-security description: Multi-layered security audit system for GitHub/ClawHub releases. Prevents credential leaks, detects vulnerabilities, validates documentation. Frequency-aware scanning (quick/history/dependencies). Blocks bad pushes automatically. version: 2.0.0 author: solmas homepage: https://github.com/solmas/openclaw-pre-publish-security license: MIT tags:
- security
- git
- audit
- credentials
- publishing
- dependencies
- cve
metadata:
openclaw:
requires:
bins: [git, jq, grep]
optional: [npm, pip, safety, shellcheck]
install:
- { id: jq, kind: apt, package: jq } user-invocable: true
Pre-Publish Security Protocol
Prevents security breaches like exposed credentials in open-source releases.
Features
✅ Multi-Level Scanning
- Quick scan: Every push (~5s)
- History scan: Monthly deep dive (~2-5min)
- Dependency CVE: Weekly npm/Python check (~30s)
- Full audit: On-demand comprehensive (~3-6min)
✅ Smart Frequency Management
- State tracking knows when each scan last ran
- Auto-determines which scans to run
- Prevents redundant checks
✅ What It Catches
- GitHub PATs, API keys, passwords, private keys
- Secrets in git history (even if "deleted")
- npm/Python dependency CVEs
- Unsafe code patterns (eval, exec)
- Documentation placeholders (
[ORG],example.com) - Missing LICENSE/README files
- Exported environment variables with secrets
✅ Automated Protection
- Git pre-push hook blocks bad commits
- Severity-based exit codes (CRITICAL/HIGH/MEDIUM/LOW)
- Markdown reports with actionable fixes
Quick Start
Install Pre-Push Hook
# Automatic protection on every push
./install-hooks.sh /path/to/your/repo
Run First History Scan
# One-time deep dive (or monthly)
./audit-full.sh /path/to/repo history
Check Status
# See when scans last ran
./schedule.sh status
Run Scheduled Audits
# Auto-determines what to run based on time
./schedule.sh run /path/to/repo
Manual Scans
# Quick scan (every push)
./audit-simple.sh /path/to/repo
# Git history scan (monthly)
./audit-full.sh /path/to/repo history
# Dependency scan (weekly)
./audit-full.sh /path/to/repo dependencies
# Full audit (before releases)
./audit-full.sh /path/to/repo full
What Gets Scanned
Quick Scan (Every Push)
- Current file secret patterns
- Documentation placeholders
- Basic license/README presence
- Runtime: ~5 seconds
History Scan (Monthly)
- Full git commit history
- Deleted-but-accessible credentials
- Historical security issues
- Runtime: 2-5 minutes
Dependency Scan (Weekly)
- npm audit (Node.js CVEs)
- Python safety check
- Known vulnerabilities
- Runtime: ~30 seconds
Full Audit (On-Demand)
- All of the above
- Environment variable leaks
- Pre-commit hook verification
- Code quality patterns
- Runtime: 3-6 minutes
Severity Levels
- CRITICAL → Blocks push (secrets, credentials)
- HIGH → Requires approval (vulnerabilities, missing LICENSE)
- MEDIUM → Warning (TODOs, missing README)
- LOW → Informational
Integration
Pre-Push Hook (Recommended)
./install-hooks.sh ~/my-repo
git push # Automatic security check
Weekly Cron
# Add to OpenClaw cron
openclaw cron add \
--name "weekly-repo-scan" \
--cron "0 3 * * 1" \
--announce \
--message "Run: ~/.openclaw/workspace/skills/pre-publish-security/schedule.sh run ~/repo"
Manual Pre-Publish
# Before clawhub publish
./audit-full.sh ~/skills/my-skill full
clawhub publish skills/my-skill --version 1.0.1
Files
audit-simple.sh - Fast pre-push scan
audit-full.sh - Complete scanner with tracking
schedule.sh - Status & smart automation
install-hooks.sh - Git hook installer
audit-state.json - State tracking (auto-created)
AUDIT-SCHEDULE.md - Detailed frequency guide
README.md - Full documentation
agents/ - Sub-agent definitions (future use)
Requirements
# One-time deep dive (or monthly)
./audit-full.sh /path/to/repo history
# See when scans last ran
./schedule.sh status
Run Scheduled Audits
# Auto-determines what to run based on time
./schedule.sh run /path/to/repo
Manual Scans
# Quick scan (every push)
./audit-simple.sh /path/to/repo
# Git history scan (monthly)
./audit-full.sh /path/to/repo history
# Dependency scan (weekly)
./audit-full.sh /path/to/repo dependencies
# Full audit (before releases)
./audit-full.sh /path/to/repo full
What Gets Scanned
Quick Scan (Every Push)
- Current file secret patterns
- Documentation placeholders
- Basic license/README presence
- Runtime: ~5 seconds
History Scan (Monthly)
- Full git commit history
- Deleted-but-accessible credentials
- Historical security issues
- Runtime: 2-5 minutes
Dependency Scan (Weekly)
- npm audit (Node.js CVEs)
- Python safety check
- Known vulnerabilities
- Runtime: ~30 seconds
Full Audit (On-Demand)
- All of the above
- Environment variable leaks
- Pre-commit hook verification
- Code quality patterns
- Runtime: 3-6 minutes
Severity Levels
- CRITICAL → Blocks push (secrets, credentials)
- HIGH → Requires approval (vulnerabilities, missing LICENSE)
- MEDIUM → Warning (TODOs, missing README)
- LOW → Informational
Integration
Pre-Push Hook (Recommended)
./install-hooks.sh ~/my-repo
git push # Automatic security check
Weekly Cron
# Add to OpenClaw cron
openclaw cron add \
--name "weekly-repo-scan" \
--cron "0 3 * * 1" \
--announce \
--message "Run: ~/.openclaw/workspace/skills/pre-publish-security/schedule.sh run ~/repo"
Manual Pre-Publish
# Before clawhub publish
./audit-full.sh ~/skills/my-skill full
clawhub publish skills/my-skill --version 1.0.1
Files
audit-simple.sh - Fast pre-push scan
audit-full.sh - Complete scanner with tracking
schedule.sh - Status & smart automation
install-hooks.sh - Git hook installer
audit-state.json - State tracking (auto-created)
AUDIT-SCHEDULE.md - Detailed frequency guide
README.md - Full documentation
agents/ - Sub-agent definitions (future use)
Requirements
# Auto-determines what to run based on time
./schedule.sh run /path/to/repo
# Quick scan (every push)
./audit-simple.sh /path/to/repo
# Git history scan (monthly)
./audit-full.sh /path/to/repo history
# Dependency scan (weekly)
./audit-full.sh /path/to/repo dependencies
# Full audit (before releases)
./audit-full.sh /path/to/repo full
What Gets Scanned
Quick Scan (Every Push)
- Current file secret patterns
- Documentation placeholders
- Basic license/README presence
- Runtime: ~5 seconds
History Scan (Monthly)
- npm audit (Node.js CVEs)
- Python safety check
- Known vulnerabilities
- Runtime: ~30 seconds
Full Audit (On-Demand)
- All of the above
- Environment variable leaks
- Pre-commit hook verification
- Code quality patterns
- Runtime: 3-6 minutes
Severity Levels
- CRITICAL → Blocks push (secrets, credentials)
- HIGH → Requires approval (vulnerabilities, missing LICENSE)
- MEDIUM → Warning (TODOs, missing README)
- LOW → Informational
Integration
Pre-Push Hook (Recommended)
./install-hooks.sh ~/my-repo
git push # Automatic security check
Weekly Cron
# Add to OpenClaw cron
openclaw cron add \
--name "weekly-repo-scan" \
--cron "0 3 * * 1" \
--announce \
--message "Run: ~/.openclaw/workspace/skills/pre-publish-security/schedule.sh run ~/repo"
Manual Pre-Publish
# Before clawhub publish
./audit-full.sh ~/skills/my-skill full
clawhub publish skills/my-skill --version 1.0.1
Files
audit-simple.sh - Fast pre-push scan
audit-full.sh - Complete scanner with tracking
schedule.sh - Status & smart automation
install-hooks.sh - Git hook installer
audit-state.json - State tracking (auto-created)
AUDIT-SCHEDULE.md - Detailed frequency guide
README.md - Full documentation
agents/ - Sub-agent definitions (future use)
Requirements
- CRITICAL → Blocks push (secrets, credentials)
- HIGH → Requires approval (vulnerabilities, missing LICENSE)
- MEDIUM → Warning (TODOs, missing README)
- LOW → Informational
Integration
Pre-Push Hook (Recommended)
./install-hooks.sh ~/my-repo
git push # Automatic security check
Weekly Cron
# Add to OpenClaw cron
openclaw cron add \
--name "weekly-repo-scan" \
--cron "0 3 * * 1" \
--announce \
--message "Run: ~/.openclaw/workspace/skills/pre-publish-security/schedule.sh run ~/repo"
# Before clawhub publish
./audit-full.sh ~/skills/my-skill full
clawhub publish skills/my-skill --version 1.0.1
Files
audit-simple.sh - Fast pre-push scan
audit-full.sh - Complete scanner with tracking
schedule.sh - Status & smart automation
install-hooks.sh - Git hook installer
audit-state.json - State tracking (auto-created)
AUDIT-SCHEDULE.md - Detailed frequency guide
README.md - Full documentation
agents/ - Sub-agent definitions (future use)
Requirements
audit-simple.sh - Fast pre-push scanaudit-full.sh - Complete scanner with trackingschedule.sh - Status & smart automationinstall-hooks.sh - Git hook installeraudit-state.json - State tracking (auto-created)AUDIT-SCHEDULE.md - Detailed frequency guideREADME.md - Full documentationagents/ - Sub-agent definitions (future use)Required:
- git
- jq
- grep
Optional (enhanced detection):
- npm (Node.js dependency scanning)
- pip + safety (Python dependency scanning)
- shellcheck (bash script validation)
State Tracking
Automatically tracks:
- Last run timestamp for each scan type
- Total scan counts
- Cumulative findings by severity
View with: ./schedule.sh status
Exit Codes
0 - Passed (no issues or low/medium only)
1 - Critical issues (blocks push)
2 - High issues (requires review)
Real-World Example
0 - Passed (no issues or low/medium only)1 - Critical issues (blocks push)2 - High issues (requires review)Problem: Accidentally pushed GitHub PAT in git remote URL
Solution: This tool caught it and blocked the push
Result: Credential never exposed publicly
Use Cases
- Individual Developers: Pre-push hook prevents accidents
- Open-Source Projects: Protects against contributor mistakes
- ClawHub Skills: Validates before publishing
- CI/CD: Add to GitHub Actions for automated checks
- Security Audits: Comprehensive repository review
Why This Exists
On 2026-03-15, a GitHub PAT was accidentally exposed in a git config file. This protocol ensures it never happens again - to anyone.
License
MIT - Use it, improve it, share it.
Contributing
Issues & PRs welcome at: https://github.com/solmas/pre-publish-security
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。