<< All versions
Skill v1.0.1
currentAutomated scan100/100rmyndharis/antigravity-skills/secrets-management
2 files
──Details
PublishedMay 23, 2026 at 09:51 PM
Content Hashsha256:ec562dfe62a437d7...
Git SHA4f9110cbfca4
Bump Typepatch
──Files
Files (1 file, 7.9 KB)
SKILL.md7.9 KBactive
SKILL.md · 366 lines · 7.9 KB
version: "1.0.1" name: secrets-management description: Implement secure secrets management for CI/CD pipelines using Vault, AWS Secrets Manager, or native platform solutions. Use when handling sensitive credentials, rotating secrets, or securing CI/CD environments.
Secrets Management
Secure secrets management practices for CI/CD pipelines using Vault, AWS Secrets Manager, and other tools.
Purpose
Implement secure secrets management in CI/CD pipelines without hardcoding sensitive information.
Use this skill when
- Store API keys and credentials
- Manage database passwords
- Handle TLS certificates
- Rotate secrets automatically
- Implement least-privilege access
Do not use this skill when
- You plan to hardcode secrets in source control
- You cannot secure access to the secrets backend
- You only need local development values without sharing
Instructions
- Identify secret types, owners, and rotation requirements.
- Choose a secrets backend and access model.
- Integrate CI/CD or runtime retrieval with least privilege.
- Validate rotation and audit logging.
Safety
- Never commit secrets to source control.
- Limit access and log secret usage for auditing.
Secrets Management Tools
HashiCorp Vault
- Centralized secrets management
- Dynamic secrets generation
- Secret rotation
- Audit logging
- Fine-grained access control
AWS Secrets Manager
- AWS-native solution
- Automatic rotation
- Integration with RDS
- CloudFormation support
Azure Key Vault
- Azure-native solution
- HSM-backed keys
- Certificate management
- RBAC integration
Google Secret Manager
- GCP-native solution
- Versioning
- IAM integration
HashiCorp Vault Integration
Setup Vault
bash
# Start Vault dev servervault server -dev# Set environmentexport VAULT_ADDR='http://127.0.0.1:8200'export VAULT_TOKEN='root'# Enable secrets enginevault secrets enable -path=secret kv-v2# Store secretvault kv put secret/database/config username=admin password=secret
GitHub Actions with Vault
yaml
name: Deploy with Vault Secretson: [push]jobs:deploy:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4- name: Import Secrets from Vaultuses: hashicorp/vault-action@v2with:url: https://vault.example.com:8200token: ${{ secrets.VAULT_TOKEN }}secrets: |secret/data/database username | DB_USERNAME ;secret/data/database password | DB_PASSWORD ;secret/data/api key | API_KEY- name: Use secretsrun: |echo "Connecting to database as $DB_USERNAME"# Use $DB_PASSWORD, $API_KEY
GitLab CI with Vault
yaml
deploy:image: vault:latestbefore_script:- export VAULT_ADDR=https://vault.example.com:8200- export VAULT_TOKEN=$VAULT_TOKEN- apk add curl jqscript:- |DB_PASSWORD=$(vault kv get -field=password secret/database/config)API_KEY=$(vault kv get -field=key secret/api/credentials)echo "Deploying with secrets..."# Use $DB_PASSWORD, $API_KEY
Reference: See references/vault-setup.md
AWS Secrets Manager
Store Secret
bash
aws secretsmanager create-secret \--name production/database/password \--secret-string "super-secret-password"
Retrieve in GitHub Actions
yaml
- name: Configure AWS credentialsuses: aws-actions/configure-aws-credentials@v4with:aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}aws-region: us-west-2- name: Get secret from AWSrun: |SECRET=$(aws secretsmanager get-secret-value \--secret-id production/database/password \--query SecretString \--output text)echo "::add-mask::$SECRET"echo "DB_PASSWORD=$SECRET" >> $GITHUB_ENV- name: Use secretrun: |# Use $DB_PASSWORD./deploy.sh
Terraform with AWS Secrets Manager
hcl
data "aws_secretsmanager_secret_version" "db_password" {secret_id = "production/database/password"}resource "aws_db_instance" "main" {allocated_storage = 100engine = "postgres"instance_class = "db.t3.large"username = "admin"password = jsondecode(data.aws_secretsmanager_secret_version.db_password.secret_string)["password"]}
GitHub Secrets
Organization/Repository Secrets
yaml
- name: Use GitHub secretrun: |echo "API Key: ${{ secrets.API_KEY }}"echo "Database URL: ${{ secrets.DATABASE_URL }}"
Environment Secrets
yaml
deploy:runs-on: ubuntu-latestenvironment: productionsteps:- name: Deployrun: |echo "Deploying with ${{ secrets.PROD_API_KEY }}"
Reference: See references/github-secrets.md
GitLab CI/CD Variables
Project Variables
yaml
deploy:script:- echo "Deploying with $API_KEY"- echo "Database: $DATABASE_URL"
Protected and Masked Variables
- Protected: Only available in protected branches
- Masked: Hidden in job logs
- File type: Stored as file
Best Practices
- Never commit secrets to Git
- Use different secrets per environment
- Rotate secrets regularly
- Implement least-privilege access
- Enable audit logging
- Use secret scanning (GitGuardian, TruffleHog)
- Mask secrets in logs
- Encrypt secrets at rest
- Use short-lived tokens when possible
- Document secret requirements
Secret Rotation
Automated Rotation with AWS
python
import boto3import jsondef lambda_handler(event, context):client = boto3.client('secretsmanager')# Get current secretresponse = client.get_secret_value(SecretId='my-secret')current_secret = json.loads(response['SecretString'])# Generate new passwordnew_password = generate_strong_password()# Update database passwordupdate_database_password(new_password)# Update secretclient.put_secret_value(SecretId='my-secret',SecretString=json.dumps({'username': current_secret['username'],'password': new_password}))return {'statusCode': 200}
Manual Rotation Process
- Generate new secret
- Update secret in secret store
- Update applications to use new secret
- Verify functionality
- Revoke old secret
External Secrets Operator
Kubernetes Integration
yaml
apiVersion: external-secrets.io/v1beta1kind: SecretStoremetadata:name: vault-backendnamespace: productionspec:provider:vault:server: "https://vault.example.com:8200"path: "secret"version: "v2"auth:kubernetes:mountPath: "kubernetes"role: "production"---apiVersion: external-secrets.io/v1beta1kind: ExternalSecretmetadata:name: database-credentialsnamespace: productionspec:refreshInterval: 1hsecretStoreRef:name: vault-backendkind: SecretStoretarget:name: database-credentialscreationPolicy: Ownerdata:- secretKey: usernameremoteRef:key: database/configproperty: username- secretKey: passwordremoteRef:key: database/configproperty: password
Secret Scanning
Pre-commit Hook
bash
#!/bin/bash# .git/hooks/pre-commit# Check for secrets with TruffleHogdocker run --rm -v "$(pwd):/repo" \trufflesecurity/trufflehog:latest \filesystem --directory=/repoif [ $? -ne 0 ]; thenecho "❌ Secret detected! Commit blocked."exit 1fi
CI/CD Secret Scanning
yaml
secret-scan:stage: securityimage: trufflesecurity/trufflehog:latestscript:- trufflehog filesystem .allow_failure: false
Reference Files
references/vault-setup.md- HashiCorp Vault configurationreferences/github-secrets.md- GitHub Secrets best practices
Related Skills
github-actions-templates- For GitHub Actions integrationgitlab-ci-patterns- For GitLab CI integrationdeployment-pipeline-design- For pipeline architecture