Security Checklist¶
This document outlines security practices for the ansible-execution-environment repository.
⚠️ NEVER Commit These Files¶
Secrets and Credentials¶
- ❌
files/optional-configs/rhsm-activation.env(RH_ORG, RH_ACT_KEY) - ❌
files/optional-configs/oc-install.env(if contains sensitive URLs) - ❌
tokenor any file containing ANSIBLE_HUB_TOKEN - ❌ Any file with passwords, API keys, or authentication tokens
- ❌ SSH private keys
- ❌ TLS/SSL private keys or certificates
Environment Files¶
- ❌
.envfiles with credentials - ❌
*.pemfiles (SSL certificates) - ❌
*.keyfiles (private keys) - ❌
secrets.ymlor similar credential stores
Registry Credentials¶
- ❌ Quay.io credentials
- ❌ Red Hat Registry credentials
- ❌ Docker Hub credentials
- ❌ Any
~/.docker/config.jsonor similar
✅ Protected by .gitignore¶
The following patterns are already in .gitignore:
# Secrets and credentials
files/optional-configs/rhsm-activation.env
files/optional-configs/oc-install.env
token
*.env
*.pem
*.key
secrets.yml
# Build artifacts
context/
*.tar
*.tar.gz
🔍 Pre-Commit Security Checks¶
Before EVERY commit, verify:
1. Check Git Status¶
git status
files/optional-configs/ or files ending in .env, .pem, .key
2. Review Staged Changes¶
git diff --cached
3. Grep for Common Secret Patterns¶
# Check for potential secrets in staged files
git diff --cached | grep -i -E '(password|token|secret|key|api_key|auth)'
# Check for specific credential patterns
git diff --cached | grep -E '(RH_ORG|RH_ACT_KEY|ANSIBLE_HUB_TOKEN|QUAY_)'
4. Verify .gitignore Coverage¶
# Test if sensitive files would be ignored
git check-ignore files/optional-configs/rhsm-activation.env
git check-ignore files/optional-configs/oc-install.env
git check-ignore token
🚨 If You Accidentally Commit Secrets¶
Immediate Actions¶
- DO NOT PUSH if you haven't pushed yet
-
Reset the commit:
git reset --soft HEAD~1 git restore --staged <file-with-secret> -
If already pushed to GitHub:
- Immediately rotate/revoke the exposed credentials
- Contact Red Hat security if RH credentials exposed
- Revoke GitHub tokens if exposed
- Delete and recreate Quay.io credentials
- Consider using
git-filter-repoto remove from history (consult Git docs)
Recovery Commands¶
# If you committed but didn't push
git reset --soft HEAD~1
# If you need to remove file from staging
git restore --staged <filename>
# Verify file is ignored
git check-ignore -v <filename>
📝 Safe Documentation Practices¶
In Documentation Files¶
✅ DO use examples like:
RH_ORG=your_org_id_here
RH_ACT_KEY=your_activation_key_here
OC_VERSION=stable-4.21
❌ DON'T use real values:
RH_ORG=1234567 # Real org ID
RH_ACT_KEY=abc123xyz # Real activation key
In Code Comments¶
✅ DO:
# Set your credentials in files/optional-configs/rhsm-activation.env
# Example: RH_ORG=your_org_id
❌ DON'T:
# RH_ORG=1234567 # My actual org ID
🔐 CI/CD Security¶
GitHub Actions Secrets¶
Secrets should be stored in GitHub Settings → Secrets and variables → Actions:
ANSIBLE_HUB_TOKEN- Red Hat Automation Hub tokenRH_ORG- Red Hat organization ID (optional)RH_ACT_KEY- Red Hat activation key (optional)QUAY_USERNAME- Quay.io usernameQUAY_PASSWORD- Quay.io passwordREDHAT_REGISTRY_USERNAME- Red Hat registry usernameREDHAT_REGISTRY_PASSWORD- Red Hat registry password
Workflow Security¶
Workflows access secrets via ${{ secrets.SECRET_NAME }} and should:
- Never echo secrets to logs
- Never write secrets to files that get committed
- Only use secrets in secure environment variables
- Check for secret availability before using
📋 Release Security Checklist¶
Before tagging ANY release:
- [ ] Run
git status- no uncommitted sensitive files - [ ] Run
git diff --cached- no secrets in staged changes - [ ] Grep for credential patterns in diff
- [ ] Verify
.gitignoreis protecting sensitive files - [ ] Check
files/optional-configs/is not in git - [ ] Review all documentation for hardcoded credentials
- [ ] Verify CI/CD uses GitHub Secrets, not hardcoded values
- [ ] Confirm no
tokenfile is committed - [ ] Check no
.envfiles with credentials are staged
🛡️ GitHub Security Features¶
Enable these repository settings:
Secret Scanning¶
- ✅ Enable secret scanning (Settings → Code security and analysis)
- ✅ Enable push protection to block secret pushes
- ✅ Review secret scanning alerts regularly
Dependabot Security¶
- ✅ Enable Dependabot security updates
- ✅ Review security advisories weekly
📞 Reporting Security Issues¶
If you discover a security vulnerability:
- DO NOT open a public GitHub issue
- Report to: takinosh@redhat.com
- Include: description, impact, steps to reproduce
- Allow time for fix before public disclosure