Secrets Handling
Overview
This skill defines how to handle secrets (API keys, passwords, tokens, certificates, credentials) when they appear in work products, configurations, or communications. Improper secrets handling is a critical security risk that can compromise systems and data. Treat ALL secrets as sensitive.
When to Use
- When configuring any service that requires authentication
- When working with environment variables or configuration files
- When creating documentation that references secure systems
- When integrating with external APIs or services
- When reviewing code or configuration that may contain secrets
- When setting up CI/CD pipelines with deployment credentials
- Don't use when: Working only with public, non-sensitive information
Core Procedures
Step 1: Identify Secrets
Recognize these as secrets requiring special handling:
- API keys and access tokens
- Database connection strings with credentials
- Passwords, passphrases, and PINs
- SSL/TLS certificates and private keys
- OAuth client secrets and refresh tokens
- SSH keys and deployment credentials
- Webhook secrets and signing keys
- Encryption keys and initialization vectors
- Personal identifiable information (PII)
- Financial data, account numbers
Step 2: Secret Classification
Classify each secret by sensitivity:
| Level |
Description |
Examples |
| CRITICAL |
Full system access, production data |
Prod DB passwords, root keys |
| HIGH |
Service-level access, staging systems |
API keys, staging credentials |
| MEDIUM |
Limited scope, non-critical systems |
Test tokens, sandbox keys |
| LOW |
Public or near-public information |
API documentation, public certs |
Step 3: Secure Usage
NEVER DO:
- Hardcode secrets in source code, configuration files, or documentation
- Pass secrets in URLs or query parameters
- Log secrets to console, log files, or monitoring systems
- Share secrets in plain text communications
- Store secrets in environment files committed to repositories
- Include secrets in handoff packages or deliverables
ALWAYS DO:
- Use secret management systems (env vars from secure vaults)
- Reference secrets by identifier, not by value
- Use placeholders in documentation:
[API_KEY] or ${SECRET_NAME}
- Access secrets through established secure channels only
- Rotate secrets regularly and after any potential exposure
Step 4: Document Secrets Safely
When documentation must reference secrets:
# Configuration
DATABASE_URL=postgresql://user:${DB_PASSWORD}@host:5432/db
API_KEY=${MY_SERVICE_API_KEY}
# Setup (do NOT include actual values)
Required secrets:
- DB_PASSWORD: PostgreSQL database password (from vault: db/prod/password)
- MY_SERVICE_API_KEY: API key from MyService dashboard (from vault: integrations/myservice/key)
Step 5: Secret Detection in Deliverables
Before delivering any work:
Step 6: Exposure Response
If you discover exposed secrets:
- IMMEDIATELY flag the exposure and identify the affected secret(s)
- Notify the security team (Guardian, Sentinel, Gatekeeper) or company CEO
- Do NOT share the exposed secret further
- Document the incident (what, where, when) for security team investigation
- Recommend secret rotation be performed immediately
Quality Checklist
Error Handling
- Error: Secret accidentally exposed in communication
Response: IMMEDIATELY revoke and rotate the secret, notify security team
- Error: Work requires a secret you don't have access to
Response: Request secret through proper channel (security/infrastructure team), never ask another agent for it
- Error: Found hardcoded secret in existing codebase
Response: Flag as security issue, fix with proper secret management, report to security agent
- Error: Secret has expired or is invalid
Response: Request renewal through proper channel, document expiration for monitoring
Cross-Team Integration
Related Skills: data-privacy-check, threat-modeling, audit-trail-management, incident-response
Used By: ALL agents (especially backend engineers, infrastructure, database, integrators)
1---2name: secrets-handling3description: >4 Use when working with API keys, credentials, tokens, certificates, or any sensitive5 configuration. This skill provides procedures for securely handling secrets throughout6 their lifecycle - from identification to storage, usage, rotation, and revocation.7metadata:8 source: https://skillmd.com/skills/construct-ai-primary/secrets-handling9---1011# Secrets Handling1213## Overview14This skill defines how to handle secrets (API keys, passwords, tokens, certificates, credentials) when they appear in work products, configurations, or communications. Improper secrets handling is a critical security risk that can compromise systems and data. Treat ALL secrets as sensitive.1516## When to Use17- When configuring any service that requires authentication18- When working with environment variables or configuration files19- When creating documentation that references secure systems20- When integrating with external APIs or services21- When reviewing code or configuration that may contain secrets22- When setting up CI/CD pipelines with deployment credentials23- **Don't use when:** Working only with public, non-sensitive information2425## Core Procedures2627### Step 1: Identify Secrets28Recognize these as secrets requiring special handling:29- API keys and access tokens30- Database connection strings with credentials31- Passwords, passphrases, and PINs32- SSL/TLS certificates and private keys33- OAuth client secrets and refresh tokens34- SSH keys and deployment credentials35- Webhook secrets and signing keys36- Encryption keys and initialization vectors37- Personal identifiable information (PII)38- Financial data, account numbers3940### Step 2: Secret Classification41Classify each secret by sensitivity:4243| Level | Description | Examples |44|-------|-------------|---------|45| CRITICAL | Full system access, production data | Prod DB passwords, root keys |46| HIGH | Service-level access, staging systems | API keys, staging credentials |47| MEDIUM | Limited scope, non-critical systems | Test tokens, sandbox keys |48| LOW | Public or near-public information | API documentation, public certs |4950### Step 3: Secure Usage5152#### NEVER DO:53- Hardcode secrets in source code, configuration files, or documentation54- Pass secrets in URLs or query parameters55- Log secrets to console, log files, or monitoring systems56- Share secrets in plain text communications57- Store secrets in environment files committed to repositories58- Include secrets in handoff packages or deliverables5960#### ALWAYS DO:61- Use secret management systems (env vars from secure vaults)62- Reference secrets by identifier, not by value63- Use placeholders in documentation: `[API_KEY]` or `${SECRET_NAME}`64- Access secrets through established secure channels only65- Rotate secrets regularly and after any potential exposure6667### Step 4: Document Secrets Safely68When documentation must reference secrets:69```70# Configuration71DATABASE_URL=postgresql://user:${DB_PASSWORD}@host:5432/db72API_KEY=${MY_SERVICE_API_KEY}7374# Setup (do NOT include actual values)75Required secrets:76- DB_PASSWORD: PostgreSQL database password (from vault: db/prod/password)77- MY_SERVICE_API_KEY: API key from MyService dashboard (from vault: integrations/myservice/key)78```7980### Step 5: Secret Detection in Deliverables81Before delivering any work:82- [ ] Scan all files for patterns matching: `password`, `secret`, `key`, `token`, `credential`83- [ ] Check for common secret formats: base64 strings, hex strings, connection strings84- [ ] Verify no test fixtures contain real credentials (use mock values only)85- [ ] Confirm documentation uses placeholders, not actual values86- [ ] Run secrets detection tools if available8788### Step 6: Exposure Response89If you discover exposed secrets:901. **IMMEDIATELY** flag the exposure and identify the affected secret(s)912. Notify the security team (Guardian, Sentinel, Gatekeeper) or company CEO923. Do NOT share the exposed secret further934. Document the incident (what, where, when) for security team investigation945. Recommend secret rotation be performed immediately9596## Quality Checklist97- [ ] No secrets present in source code, documentation, or deliverables98- [ ] All secret references use secure vault or environment variable patterns99- [ ] Documentation uses placeholders with setup instructions100- [ ] Secret classification is documented if applicable101- [ ] Secret detection scan was performed on all files102- [ ] Any discovered exposures are flagged and reported103104## Error Handling105- **Error:** Secret accidentally exposed in communication106 **Response:** IMMEDIATELY revoke and rotate the secret, notify security team107- **Error:** Work requires a secret you don't have access to108 **Response:** Request secret through proper channel (security/infrastructure team), never ask another agent for it109- **Error:** Found hardcoded secret in existing codebase110 **Response:** Flag as security issue, fix with proper secret management, report to security agent111- **Error:** Secret has expired or is invalid112 **Response:** Request renewal through proper channel, document expiration for monitoring113114## Cross-Team Integration115**Related Skills:** data-privacy-check, threat-modeling, audit-trail-management, incident-response116**Used By:** ALL agents (especially backend engineers, infrastructure, database, integrators)