validate-secrets

Validate SOPS encryption on secret files before committing. Use when staging secrets, committing encrypted files, or checking if secrets are properly encrypted. Prevents committing unencrypted secrets.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

The Validate Secrets skill is a specialized security tool designed to prevent the accidental exposure of sensitive data in Git repositories. By automatically scanning staged files for SOPS encryption metadata, it ensures that credentials, API keys, and configuration secrets are properly protected before they are committed, significantly reducing the risk of data breaches and improving DevSecOps compliance.

Use Cases

  • Pre-commit Security Guardrail: Automatically verify that all files in sensitive directories (like /secrets/) or matching specific patterns (like *.sops.yaml) are encrypted before allowing a commit.
  • Secret Leak Prevention: Identify plain-text secrets that were intended to be encrypted, providing developers with immediate feedback and the specific commands needed to secure the files.
  • CI/CD Pipeline Integration: Use as a validation step within automated workflows to ensure that no unencrypted sensitive information enters the codebase during the development lifecycle.
  • Compliance Auditing: Scan modified files during the peer review process to confirm that security protocols for secret management are being strictly followed.
namevalidate-secrets
descriptionValidate SOPS encryption on secret files before committing. Use when staging secrets, committing encrypted files, or checking if secrets are properly encrypted. Prevents committing unencrypted secrets.
allowed-toolsBash Read Grep Glob

Validate Secrets

Ensure secret files are properly SOPS-encrypted before commit.

For SOPS configuration and encryption details, see reference.md.

Instructions

  1. Identify files matching secret patterns in staged/modified files
  2. Check if files are SOPS-encrypted (look for sops: metadata)
  3. Report any unencrypted secrets that should be encrypted
  4. Block commit recommendation if unencrypted secrets found
  5. DO NOT automatically run sops --encrypt or sops --decrypt commands - inform the user to run these manually

Secret File Patterns

Files that MUST be encrypted:

Pattern Description
*.sops.yaml SOPS encrypted files
*sopssecret*.yaml SopsSecret CRDs
*/secrets/*.yaml Files in secrets directories
*secret*.yaml Files with "secret" in name

Validation Check

A file is SOPS-encrypted if it contains:

sops:
    kms: []
    age:
        - recipient: age1...

Or for SopsSecret CRDs:

kind: SopsSecret
spec:
    secretTemplates:
        ...
sops:
    ...

Output

Safe to commit:

  • List encrypted files that passed validation

BLOCKED - Unencrypted secrets found:

  • List files that match secret patterns but lack SOPS encryption
  • Inform user to manually encrypt: sops --encrypt --in-place <file>
  • DO NOT run the encryption command automatically

Integration

This skill is called by commit-workflow before staging secret files.