How to Manage Secrets and Credentials in reverse-skill: A Complete Security Guide
The reverse-skill repository manages secrets through GitHub Actions encrypted secrets (${{ secrets.NAME }}), strict authorization checklists, and documentation-only examples that never store real credentials.
reverse-skill is a modular security skill router that stitches together playbooks, reference documents, and automation scripts for red team and blue team operations. Understanding how to manage secrets and credentials in reverse-skill is critical because the repository deliberately bridges offensive security research with defensive implementation—requiring rigorous controls to prevent accidental credential exposure.
Architecture Overview: Where Secrets Live in reverse-skill
The repository splits into three layers, each with distinct secret-handling responsibilities:
| Layer | Purpose | Key Directories |
|---|---|---|
| Core Router | Decides which skill to execute | skills/MASTER-ROUTING.md, skills/scripts/master-route.ps1 |
| Skill Packages | Domain-specific techniques and tools | skills/windows-ad/, skills/pentest-tools/, skills/field-journal/ |
| Support & Docs | Global policies and CI helpers | docs/, RULES.md, README.md |
Secrets never reside in version control. Instead, the project uses placeholder syntax and runtime environment injection exclusively.
Central Policy: RULES.md Security Enforcement
The RULES.md file at the repository root defines mandatory security policies that all skills must follow. According to the reverse-skill source code, this includes:
- Explicit prohibition against committing production credentials
- Authorization gates before any credential extraction tool execution
- Cleanup requirements post-execution to remove extracted data
□ secretsdump / lsassy / mimikatz(严格授权与清理)
This checklist appears in skills/windows-ad/SKILL.md and must be completed before running credential-dumping tools. The Chinese annotation translates to "strict authorization and cleanup"—a core principle for managing secrets and credentials in reverse-skill workflows.
GitHub Actions Secret Pattern
CI/CD examples demonstrate the canonical secret injection method. In skills/supply-chain-security/references/cicd-pipeline-security.md:
-H "X-Api-Key: ${{ secrets.DTRACK_API_KEY }}" \
The ${{ secrets.<NAME> }} syntax ensures:
- Secrets remain encrypted at rest in GitHub
- Workflow logs automatically mask secret values
- Fork pull requests cannot access repository secrets
Secure vs. Insecure Workflow Comparison
# ✅ SECURE: Uses secrets context, runs on standard pull_request
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./run-analysis.sh
# Secrets unavailable—safe for forks
# ⚠️ OPAQUE: pull_request_target with secrets requires extra scrutiny
on:
pull_request_target:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- run: curl -H "Token: ${{ secrets.DEPLOY_KEY }}" ...
# Forks CAN access secrets—implement path filtering!
The repository explicitly documents pull_request_target as a supply-chain risk when secrets are involved.
Skill-Level Secret Management Patterns
Offensive Research: Documentation-Only Secrets
Pentest tool playbooks contain illustrative commands showing how attackers discover secrets, never how defenders should store them. From skills/pentest-tools/src-hunter/references/playbooks/unauth-access.md:
# Memory forensics: finding credential artifacts
strings heap.bin | grep -iE "(password|jdbc|secret|key)" | sort -u
# Environment variable exposure check
cat /proc/self/environ | strings
# Cloud metadata credential harvesting
curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/
These examples appear in references/playbooks/ to ensure they educate without becoming operational secrets.
Defensive Implementation: Runtime Environment Loading
Safe secret consumption patterns use environment variables loaded at runtime:
# Pattern from defensive skill implementations
import os
def get_api_key():
"""Load secret from environment—never hardcode."""
api_key = os.getenv('API_KEY')
if not api_key:
raise RuntimeError('API_KEY not set')
return api_key
Post-Execution Cleanup Protocol
Windows AD skills require mandatory cleanup after credential operations:
# Execute mimikatz with logging
mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords" /export
# Immediate removal of extracted data
Remove-Item C:\temp\mimikatz_dump.txt -Force
del /f /q *.txt
Cloud Metadata Secret Exposure Risks
The repository flags cloud instance metadata services as covert secret channels. skills/field-journal/seed-006_ssrf-cloud-metadata.md documents:
# AWS IMDSv1 credential extraction (vulnerable configuration)
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/role-name
# GCP equivalent
curl "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" -H "Metadata-Flavor: Google"
Mitigation: Disable unnecessary metadata exposure and require IMDSv2 session tokens.
Practical Checklist for Secret Management
| Scenario | Approach | Implementation |
|---|---|---|
| CI/CD authentication | GitHub Actions encrypted secrets | ${{ secrets.NAME }} in workflow files only |
| Local development | dotenv files (gitignored) | Load via os.getenv() or equivalent |
| Red team playbooks | Illustrative placeholders only | REDACTED or PLACEHOLDER strings |
| Credential tool usage | Authorization checklist + cleanup | skills/windows-ad/SKILL.md procedure |
| Cloud deployments | Metadata service hardening | Disable IMDSv1, use least-privilege roles |
Summary
- Never commit secrets: The repository enforces this through
RULES.mdpolicy and.gitignorepatterns - Use GitHub Actions secrets: The
${{ secrets.NAME }}syntax is the standard for CI/CD workflows - Document safely: All offensive techniques use placeholder values in
references/playbooks/ - Authorize and cleanup: Every credential extraction requires checklist completion and immediate data removal
- Audit continuously: Search patterns like
strings \| grep -i secretverify no accidental exposures
Frequently Asked Questions
Does reverse-skill store any real credentials in the repository?
No. As implemented in zhaoxuya520/reverse-skill, all credential references are illustrative placeholders. Production secrets use GitHub Actions encrypted secrets (${{ secrets.NAME }}) or runtime environment variables exclusively.
How does reverse-skill prevent secret leakage in CI pipelines?
The skills/supply-chain-security/references/cicd-pipeline-security.md file documents two controls: using standard pull_request triggers (which block secret access from forks) and automatic log masking for ${{ secrets.* }} variables. Workflows requiring pull_request_target implement additional path-based filtering.
What authorization is required before running credential-dumping tools?
Each skill package includes a checklist in its SKILL.md file. For skills/windows-ad/SKILL.md, operators must confirm "strict authorization and cleanup" (严格授权与清理) before executing mimikatz, secretsdump, or lsassy, followed by mandatory deletion of extracted files.
Where should I report accidental secret exposure in reverse-skill?
Submit through the repository's security disclosure process documented in RULES.md. The policy requires immediate rotation of any exposed credentials and forensic analysis of access logs to determineblast radius.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →