Skip to content

Latest commit

 

History

History
207 lines (154 loc) · 6.42 KB

File metadata and controls

207 lines (154 loc) · 6.42 KB

Security Checklist for Public Repository

This document outlines the security measures taken before publishing Containarium to a public repository.

✅ Completed Security Measures

1. Sensitive Files Excluded

Created .gitignore with comprehensive exclusions:

  • ✅ Terraform state files (*.tfstate, *.tfstate.*)
  • ✅ Terraform variable files (*.tfvars)
  • ✅ Terraform cache (.terraform/)
  • ✅ Environment files (.env, .env.*)
  • ✅ Credentials (*.pem, *.key, credentials.json)
  • ✅ SSH keys (id_rsa*)
  • ✅ Build artifacts (bin/, *.exe)
  • ✅ Logs and reports (*.log, *-report.txt)

2. Git History Cleaned

Removed from git tracking:

  • terraform/gce/terraform.tfstate (contained instance IPs, project IDs)
  • terraform/gce/terraform.tfvars (contained SSH keys, project ID, user IP)

Command used:

git rm --cached terraform/gce/terraform.tfstate terraform/gce/terraform.tfvars

3. Example Configuration Created

Created terraform/gce/terraform.tfvars.example:

  • ✅ Contains placeholder values only
  • ✅ No real project IDs, SSH keys, or IP addresses
  • ✅ Documented for users to copy and customize

4. Code Review

Verified no hardcoded secrets in:

  • ✅ Go source code files
  • ✅ Terraform configuration files
  • ✅ Shell scripts
  • ✅ Documentation files

Environment variables used instead:

  • GCP_PROJECT - For GCP project ID (in tests)
  • Users must provide their own:
    • Project ID in terraform.tfvars
    • SSH keys in terraform.tfvars
    • Allowed IP addresses in terraform.tfvars

📋 Before Pushing to Public Repo

Final Verification Checklist

Run these commands to verify no sensitive data will be pushed:

# 1. Check git status
git status

# 2. Verify .gitignore is working
git status --ignored

# 3. Search for potential secrets in tracked files
git grep -i "<your-gcp-project>" -- ':!*.md' ':!SECURITY-CHECKLIST.md'
git grep -E "ssh-(rsa|ed25519) AAAA" -- ':!terraform/gce/terraform.tfvars.example'
git grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" -- ':!*.md' ':!SECURITY-CHECKLIST.md'

# 4. Check for accidentally staged files
git diff --cached --name-only | grep -E "(tfstate|tfvars|\.env|\.key|\.pem)"

# 5. Verify terraform.tfvars is ignored
ls terraform/gce/terraform.tfvars 2>/dev/null && echo "⚠️  WARNING: terraform.tfvars still exists (should be in .gitignore)" || echo "✅ terraform.tfvars not in working directory"

What Should Be Committed

Safe to commit:

  • .gitignore
  • terraform/gce/terraform.tfvars.example
  • ✅ All Go source code
  • ✅ All Terraform .tf files
  • ✅ Documentation files
  • ✅ Shell scripts (startup scripts)
  • ✅ Makefile
  • ✅ README.md

DO NOT commit:

  • terraform/gce/terraform.tfvars (personal config)
  • terraform/gce/terraform.tfstate* (state files)
  • terraform/gce/.terraform/ (provider cache)
  • bin/ (compiled binaries)
  • ❌ Any files with real credentials, IPs, or keys

🔐 User Security Setup

Document for users to follow after cloning:

1. Configure Terraform Variables

cd terraform/gce
cp terraform.tfvars.example terraform.tfvars
vim terraform.tfvars

Required changes:

project_id = "your-gcp-project-id"  # Your GCP project

admin_ssh_keys = {
  admin = "ssh-ed25519 AAAA... your-email@example.com"  # Your SSH public key
}

# Get your IP: curl ifconfig.me
allowed_ssh_sources = ["YOUR.IP.ADDRESS/32"]  # Your IP, not 0.0.0.0/0!

2. Set Environment Variables

# For E2E tests
export GCP_PROJECT=your-gcp-project-id

# For local development (if needed)
export CONTAINARIUM_ENV=development

3. GCP Authentication

# Authenticate with GCP
gcloud auth login
gcloud auth application-default login

# Set default project
gcloud config set project your-gcp-project-id

🚨 Security Best Practices

For Users

  1. Never commit terraform.tfvars - Always in .gitignore
  2. Use narrow IP ranges - Don't use 0.0.0.0/0 for allowed_ssh_sources
  3. Rotate SSH keys regularly - Update admin_ssh_keys periodically
  4. Enable MFA on GCP - Require multi-factor authentication
  5. Use service accounts - For CI/CD, create dedicated service accounts
  6. Review Terraform plan - Always run terraform plan before apply
  7. Enable audit logging - Monitor all infrastructure changes

For Contributors

  1. Never commit secrets - Use environment variables
  2. No hardcoded IPs - Use Terraform outputs and variables
  3. No real emails - Use user@example.com in examples
  4. Review diffs - Check git diff before committing
  5. Use pre-commit hooks - Install secret scanning tools

📊 Sensitive Data Removed

Summary of Sensitive Data Removed from Git

File Sensitive Data Status
terraform/gce/terraform.tfvars SSH keys, project ID, IP address ✅ Removed
terraform/gce/terraform.tfstate Instance IPs, project ID, resource IDs ✅ Removed
terraform/gce/terraform.tfstate.backup Previous state data ✅ Never committed

Data Types Excluded

  • ❌ GCP Project IDs (except in examples as placeholders)
  • ❌ SSH Public/Private Keys (except in examples as placeholders)
  • ❌ IP Addresses (except in examples as placeholders)
  • ❌ Instance IPs and Resource IDs
  • ❌ Email addresses (except in documentation as examples)
  • ❌ Authentication tokens or credentials

✅ Final Checklist Before Push

  • Run all verification commands above
  • Confirm .gitignore is committed
  • Confirm terraform.tfvars.example exists and has placeholders only
  • Confirm terraform.tfvars is NOT in git (git ls-files | grep tfvars should show only examples)
  • Confirm terraform.tfstate is NOT in git
  • Review git log --stat to ensure no sensitive files in history
  • Test that repository builds without secrets: make build
  • Update README.md with current architecture (completed ✅)
  • Create release notes if applicable

🎯 Post-Publication Steps

After making the repository public:

  1. Monitor Issues - Watch for security reports
  2. Enable GitHub Security Features:
    • Dependabot alerts
    • Secret scanning
    • Code scanning (CodeQL)
  3. Add SECURITY.md - Describe security policy
  4. Tag Release - Create v1.0.0 tag when ready
  5. Documentation - Ensure all docs are up to date

📞 Contact

For security issues, please email: [your-security-email@example.com]