secrets-management
БесплатноБез исполняемых скриптовНе проверенSecrets and credentials management. Covers environment variables, secret stores, rotation policies, and detection of leaked secrets. USE WHEN: user mentions…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Secrets Management
Golden Rules
- Never commit secrets to version control
- Never log secrets in application logs
- Rotate secrets regularly
- Use least privilege for access
- Encrypt at rest and in transit
When NOT to Use This Skill
- JWT/OAuth implementation - Use authentication skills for protocol setup
- Database security - Use database skills for connection security
- General OWASP issues - Use
owasp-top-10for broader security - Dependency vulnerabilities - Use
supply-chainfor package security
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:securityfor comprehensive documentation.
Environment Variables
.env Files
# .env (never commit!)
DATABASE_URL=postgresql://user:pass@localhost:5432/db
API_KEY=sk-xxx
JWT_SECRET=super-secret-key
# .env.example (commit this - no real values)
DATABASE_URL=postgresql://user:pass@host:5432/db
API_KEY=your-api-key-here
JWT_SECRET=generate-a-secure-secret
.gitignore
# Secrets - ALWAYS ignore
.env
.env.local
.env.*.local
*.pem
*.key
credentials.json
secrets.yaml
Loading in Code
// Node.js with dotenv
import 'dotenv/config';
const apiKey = process.env.API_KEY;
// Validate required vars at startup
const required = ['DATABASE_URL', 'API_KEY', 'JWT_SECRET'];
for (const key of required) {
if (!process.env[key]) {
throw new Error(`Missing required env var: ${key}`);
}
}
Secret Detection
Pre-commit Hooks
# .pre-commit-config.yaml
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaks
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
Scanning Commands
# Gitleaks - scan entire history
gitleaks detect --source . --verbose
# Scan only staged changes
gitleaks protect --staged
# TruffleHog
trufflehog git file://. --only-verified
# GitHub secret scanning (in repo settings)
# Enable "Secret scanning" and "Push protection"
Secret Stores
HashiCorp Vault
import Vault from 'node-vault';
const vault = Vault({
apiVersion: 'v1',
endpoint: process.env.VAULT_ADDR,
token: process.env.VAULT_TOKEN
});
const { data } = await vault.read('secret/data/myapp');
const dbPassword = data.data.db_password;
AWS Secrets Manager
import { SecretsManager } from '@aws-sdk/client-secrets-manager';
const client = new SecretsManager({ region: 'us-east-1' });
const response = await client.getSecretValue({ SecretId: 'myapp/db' });
const secret = JSON.parse(response.SecretString!);
Environment-based (Simpler)
// For smaller projects, use encrypted env vars in CI/CD
// GitHub Actions, GitLab CI, etc. all support this
// GitHub Actions
// Settings > Secrets and variables > Actions > New secret
CI/CD Secrets
GitHub Actions
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
API_KEY: ${{ secrets.API_KEY }}
run: |
# Secrets available as env vars
./deploy.sh
# NEVER do this:
# - run: echo ${{ secrets.API_KEY }}
Docker
# Never bake secrets into images
# Wrong:
ENV API_KEY=secret
# Right: pass at runtime
# docker run -e API_KEY=$API_KEY myimage
# docker-compose.yml
services:
app:
environment:
- DATABASE_URL # From shell env
env_file:
- .env # From file (not committed)
Secret Rotation
Policy
| Secret Type | Rotation Frequency |
|---|---|
| API keys | 90 days |
| Database passwords | 90 days |
| JWT secrets | 180 days |
| Service accounts | 365 days |
| After compromise | Immediately |
Rotation Process
- Generate new secret
- Update in secret store
- Deploy new secret to services
- Verify functionality
- Revoke old secret
- Update documentation
Detecting Leaked Secrets
If a secret is leaked:
- Revoke immediately - Don't wait
- Rotate - Generate new credentials
- Audit - Check for unauthorized access
- Clean history - Use BFG or git-filter-repo
- Post-mortem - Document and prevent recurrence
# Remove from git history (use BFG)
bfg --replace-text passwords.txt repo.git
git reflog expire --expire=now --all
git gc --prune=now --aggressive
Security Checklist
- .env files in .gitignore
- .env.example with dummy values committed
- Pre-commit hooks for secret detection
- CI/CD secrets in encrypted store
- No secrets in Docker images
- Rotation policy defined
- Least privilege access
- GitHub secret scanning enabled
Common Secret Patterns
# AWS
AKIA[0-9A-Z]{16}
aws_secret_access_key\s*=\s*.+
# GitHub
ghp_[a-zA-Z0-9]{36}
github_pat_[a-zA-Z0-9]{22}_[a-
Установить secrets-management в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobFAQ
Что делает скилл secrets-management?
Secrets and credentials management. Covers environment variables, secret stores, rotation policies, and detection of leaked secrets. USE WHEN: user mentions "secrets", "credentials", "API keys", "environment variables", ".env", asks about "secret leaks", "vault", "secret rotation", "gitleaks", "secret detection" DO NOT USE FOR: OWASP vulnerabilities - use `owasp-top-10`, supply chain - use `supply-chain`, general security - use `owasp`
Как установить скилл secrets-management?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл secrets-management запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic