This document outlines the security practices and secrets management strategy for the Agentic Flow project. It covers credential management across local development, CI/CD, and production environments.
Different environments require different security postures:
| Environment | Storage Method | Risk Level | Validation |
|---|---|---|---|
| Local Development | .env files (git-ignored) |
Low | Development placeholders OK |
| CI/CD | GitHub Secrets | Medium | Required for automated tests |
| Staging | AWS Secrets Manager | Medium-High | Production-like credentials |
| Production | HashiCorp Vault / AWS Secrets Manager | High | Encrypted, rotated, audited |
Storage: .env files (NEVER committed to git)
Setup:
# 1. Copy template
cp .env.example .env
# 2. Fill in your credentials
vi .env
# 3. Verify .env is git-ignored
grep "^\.env$" .gitignore || echo ".env" >> .gitignoreBest Practices:
- Use development/sandbox API keys when available
- Keep local
.envfile permissions restrictive:chmod 600 .env - Never share your
.envfile via Slack, email, or screenshots - Use placeholder values for services you're not actively developing
Validation:
# Check for missing credentials
./scripts/validate-secrets.sh
# Verify no secrets in git history
git log -p | grep -E "(sk-ant|sk-|glpat-)" && echo "⚠️ Secrets found in git history!"Storage: GitHub Repository Secrets
Setup:
- Navigate to: Repository → Settings → Secrets and variables → Actions
- Add secrets using "New repository secret"
- Reference in workflows:
${{ secrets.ANTHROPIC_API_KEY }}
Required Secrets for CI:
ANTHROPIC_API_KEY- For LLM-based testsAWS_ACCESS_KEY_ID- For AWS integration testsAWS_SECRET_ACCESS_KEY- For AWS integration testsGITHUB_TOKEN- Auto-provided, for GitHub API access
Optional Secrets (skip tests if not set):
STRIPE_SECRET_KEY- Payment integration testsDISCORD_BOT_TOKEN- Discord bot testsHIVELOCITY_API_KEY- Infrastructure tests
Workflow Example:
name: Test Suite
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v3
- run: npm testStorage: HashiCorp Vault or AWS Secrets Manager
AWS Secrets Manager (Recommended):
# Store secret
aws secretsmanager create-secret \
--name agentic-flow/prod/anthropic-api-key \
--secret-string "sk-ant-xxxxx" \
--region us-west-1
# Retrieve secret in application
aws secretsmanager get-secret-value \
--secret-id agentic-flow/prod/anthropic-api-key \
--region us-west-1 \
--query SecretString \
--output textHashiCorp Vault (Alternative):
# Write secret
vault kv put secret/agentic-flow/prod \
anthropic_api_key="sk-ant-xxxxx" \
stripe_secret_key="sk_live_xxxxx"
# Read secret
vault kv get -field=anthropic_api_key secret/agentic-flow/prod- ✅ SET: Credential configured and validated
⚠️ PLACEHOLDER: Development placeholder in use- ❌ MISSING: Not configured, blocking functionality
- 🔄 ROTATION_NEEDED: Credential should be rotated
AWS_ACCESS_KEY_ID- ✅ SETAWS_SECRET_ACCESS_KEY- ✅ SETAWS_REGION- ✅ SET (us-west-1)
Rotation Schedule: Every 90 days
Last Rotated: Check with aws iam list-access-keys
ANTHROPIC_API_KEY-⚠️ PLACEHOLDER (some environments)OPENAI_API_KEY-⚠️ PLACEHOLDEROPENROUTER_API_KEY-⚠️ PLACEHOLDERGEMINI_API_KEY- ❌ MISSING
Rotation Schedule: API keys don't expire but should be rotated every 180 days Cost Monitoring: Set up billing alerts at $50, $100, $500 thresholds
POSTGRES_PASSWORD-⚠️ PLACEHOLDER (local dev only)
Rotation Schedule: Every 60 days for production
Backup: Encrypted daily backups to S3
GITLAB_TOKEN- ❌ MISSINGGITHUB_TOKEN- ✅ AUTO-PROVIDED (in GitHub Actions)
Rotation Schedule: Personal access tokens every 90 days
PASSBOLT_API_TOKEN- ❌ MISSING
Rotation Schedule: Every 90 days
CLOUDFLARE_API_TOKEN-⚠️ PLACEHOLDERCLOUDFLARE_API_KEY-⚠️ PLACEHOLDERCLOUDFLARE_EMAIL-⚠️ PLACEHOLDERCPANEL_API_KEY- ❌ MISSINGHOSTBILL_API_KEY- ❌ MISSING (Error: HOSTBILL_001)HOSTBILL_API_ID- ❌ MISSINGHOSTBILL_URL- ❌ MISSINGHIVELOCITY_API_KEY- ✅ SET
Rotation Schedule: Every 180 days
STRIPE_SECRET_KEY- ❌ MISSINGSTRIPE_PUBLIC_KEY- ❌ MISSINGSTRIPE_WEBHOOK_SECRET- ❌ MISSINGPAYPAL_CLIENT_ID- ❌ MISSINGPAYPAL_CLIENT_SECRET- ❌ MISSINGKLARNA_USERNAME- ❌ MISSINGKLARNA_PASSWORD- ❌ MISSINGSQUARE_ACCESS_TOKEN- ❌ MISSING
Rotation Schedule: Every 90 days
PCI Compliance: Required for production payment processing
DISCORD_BOT_TOKEN- ❌ MISSING (blocking Discord integration)PLIVO_AUTH_ID- ❌ MISSINGPLIVO_AUTH_TOKEN- ❌ MISSINGTELNYX_API_KEY- ❌ MISSING
Rotation Schedule: Every 180 days
Prevention:
# Install pre-commit hook
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/bash
# Prevent committing secrets
if git diff --cached | grep -E "(sk-ant|sk-|API_KEY.*=.*[a-zA-Z0-9]{20,}|SECRET.*=.*[a-zA-Z0-9]{20,})"; then
echo "⚠️ Potential secret detected in commit! Aborting."
exit 1
fi
EOF
chmod +x .git/hooks/pre-commitDetection:
# Scan for accidentally committed secrets
git log -p | grep -E "(sk-ant|sk-|glpat-|ghp_)" || echo "✅ No secrets found"
# Use git-secrets tool
git secrets --scan- Create service-specific IAM roles with minimal permissions
- Use read-only credentials for monitoring/observability
- Separate credentials for dev/staging/production
Automated Rotation (Production):
# AWS Secrets Manager automatic rotation
aws secretsmanager rotate-secret \
--secret-id agentic-flow/prod/anthropic-api-key \
--rotation-lambda-arn arn:aws:lambda:us-west-1:xxx:function:rotate-secretManual Rotation Checklist:
- Generate new credential in provider dashboard
- Update secret in secrets manager
- Deploy updated configuration
- Verify application works with new credential
- Revoke old credential after 24-hour grace period
- Document rotation in changelog
CloudWatch Alarms (AWS):
# Monitor API key usage
aws cloudwatch put-metric-alarm \
--alarm-name agentic-flow-unusual-api-usage \
--metric-name CallCount \
--threshold 10000 \
--comparison-operator GreaterThanThresholdAudit Logs:
- GitHub Actions: View workflow runs for secret access
- AWS CloudTrail: Monitor Secrets Manager access
- Vault Audit: Review secret read operations
Compromised Credential Response:
-
Immediate (< 5 minutes):
# Revoke compromised credential aws iam delete-access-key --access-key-id AKIA... -
Short-term (< 1 hour):
- Generate replacement credential
- Update secrets manager
- Deploy emergency patch
- Notify security team
-
Post-incident (< 24 hours):
- Review access logs for unauthorized usage
- Assess blast radius
- Document incident in
.goalie/SECURITY_INCIDENTS.yaml - Update rotation schedule
# Run validation script
./scripts/validate-secrets.sh
# Expected output:
# ✅ AWS credentials valid
# ⚠️ ANTHROPIC_API_KEY not set
# ❌ STRIPE_SECRET_KEY missing (required for payment tests)When credentials are not available in CI, tests requiring external APIs should be skipped:
// In test file
describe('Stripe Integration', () => {
beforeAll(() => {
if (!process.env.STRIPE_SECRET_KEY) {
console.log('⚠️ Skipping Stripe tests (STRIPE_SECRET_KEY not set)');
}
});
it('should process payment', () => {
if (!process.env.STRIPE_SECRET_KEY) {
return; // Skip test
}
// Test implementation
});
});- Required for: Stripe, PayPal, Klarna, Square integrations
- Key requirements:
- Encrypt cardholder data at rest and in transit
- Maintain secure network
- Regular security testing
- Access control measures
- Applies to: User data, analytics, EU customers
- Key requirements:
- Data encryption
- Right to deletion
- Breach notification (72 hours)
- Data processing agreements
- Recommended for: Production SaaS deployment
- Key controls:
- Access control
- Change management
- Incident response
- Business continuity
- git-secrets: Prevent committing secrets (GitHub)
- truffleHog: Find secrets in git history (GitHub)
- detect-secrets: Pre-commit hook for secrets (GitHub)
- AWS Secrets Manager: https://docs.aws.amazon.com/secretsmanager/
- HashiCorp Vault: https://www.vaultproject.io/docs
- GitHub Actions Secrets: https://docs.github.com/en/actions/security-guides/encrypted-secrets
Security Issues: Create issue with security label in .goalie/CONSOLIDATED_ACTIONS.yaml
Credential Requests: Contact DevOps team with justification and least-privilege requirements
Incident Response: Follow emergency procedures above, notify security team immediately
Last Updated: 2025-12-01T00:17Z
Owner: Seeker Circle (Exploration & Discovery Lead)
Review Schedule: Quarterly (every 90 days)