This document describes what to check before committing code to ensure no sensitive information is exposed in the repository.
Check: config.yaml should NEVER be committed
- ✅
config.yamlis in.gitignore - ✅ Only
config.yaml.example(with placeholders) should be tracked - ❌ Never commit
config.yamlwith real API keys
How to verify:
# Check if config.yaml is tracked
git ls-files | grep config.yaml
# Should only show: config.yaml.example
# Should NOT show: config.yamlWhat to look for:
- Real API keys (not "YOUR_API_KEY_HERE")
- Real API secrets (not "YOUR_API_SECRET_HERE")
- Any actual credentials
Check: No real API credentials in any tracked files
Search for sensitive patterns:
# Search for API key patterns (should only find placeholders)
git grep -i "amadeus_api_key\|amadeus_api_secret" -- "*.py" "*.yaml" "*.yml" "*.md"
# Should only find:
# - "YOUR_API_KEY_HERE"
# - "YOUR_API_SECRET_HERE"
# - Example/test code
# Should NOT find actual keys like: "abc123xyz..." or "sk_live_..."What to look for:
- Long alphanumeric strings that look like API keys
- Keys starting with common patterns:
sk_,pk_,AKIA,ghp_, etc. - Any strings that look like secrets (long random strings)
Check: No hardcoded environment variables with real values
Search for:
git grep -i "os.environ\|getenv\|environ\[" -- "*.py"What to look for:
- Hardcoded values instead of reading from environment/config
- Actual credentials in environment variable assignments
Check: Cache files don't contain sensitive information
Files to review:
data/destinations_cache/*.json- Should only contain destination datadata/flights_cache/*.json- Should only contain flight data
What to look for:
- API keys in cached responses
- Authentication tokens
- Personal information (though flight data is generally safe)
Note: Cache files are currently tracked in git. Consider:
- Moving them to
.gitignoreif they contain any sensitive data - Or keeping them if they're safe (just flight/destination data)
Check: No log files with sensitive information
Files to check:
debug_logs/*.log- Should be in.gitignore✅- Any
*.logfiles
What to look for:
- API keys in error messages
- Full request/response bodies with credentials
- Stack traces exposing file paths with sensitive data
Check: No output files with sensitive data
Files to check:
*.csvfiles (should be in.gitignore✅)flight_results.csv(should be in.gitignore✅)
What to look for:
- Personal information
- API keys in output
- Any sensitive data
Check: No hardcoded credentials in source code
Search for:
# Search for common credential patterns
git grep -E "(api[_-]?key|api[_-]?secret|password|token|credential)" -- "*.py" -i
# Search for long strings that might be keys
git grep -E "[a-zA-Z0-9]{32,}" -- "*.py"What to look for:
- Hardcoded API keys
- Hardcoded secrets
- Passwords
- Tokens
- Any long random strings
Check: Documentation only contains placeholders, not real keys
Files to check:
README.mddocs/*.mdPROJECT_EXPLANATION.mdFLIGHT_RESULTS_EXPLANATION.md
What to look for:
- Only "YOUR_API_KEY_HERE" type placeholders
- No actual credentials in examples
- No real API keys in screenshots or examples
You can create a pre-commit hook to automatically check for secrets:
#!/bin/bash
# .git/hooks/pre-commit
# Check for real API keys (not placeholders)
if git diff --cached | grep -E "amadeus_api_key|amadeus_api_secret" | grep -v "YOUR_API_KEY\|YOUR_API_SECRET\|example"; then
echo "ERROR: Found potential API key in staged files!"
echo "Make sure you're only committing config.yaml.example with placeholders"
exit 1
fi
# Check if config.yaml is being committed
if git diff --cached --name-only | grep -E "^config\.yaml$"; then
echo "ERROR: config.yaml should not be committed!"
echo "Only config.yaml.example should be tracked"
exit 1
fi
exit 0Install and configure git-secrets for automatic detection:
# Install git-secrets
brew install git-secrets # macOS
# or download from: https://github.com/awslabs/git-secrets
# Configure for this repo
cd /path/to/fladar
git secrets --install
git secrets --register-aws # For AWS patterns
git secrets --add 'amadeus.*[a-zA-Z0-9]{32,}' # Custom patternBefore each commit, manually verify:
-
config.yamlis NOT in the commit (check withgit status) - Only
config.yaml.exampleis tracked - All API key references are placeholders ("YOUR_API_KEY_HERE")
- No real credentials in any Python files
- No credentials in documentation files
- Cache files don't contain sensitive data
- Log files are not committed
- Output files (CSV) are not committed
- No hardcoded secrets in source code
- Environment variables are read from config, not hardcoded
If you accidentally commit sensitive information:
-
Immediately revoke the exposed credentials:
- Go to Amadeus Developer Portal
- Regenerate API keys
- Update your local
config.yaml
-
Remove from git history:
# Remove file from history (if it was committed) git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch config.yaml" \ --prune-empty --tag-name-filter cat -- --all # Force push (WARNING: This rewrites history) git push origin --force --all
-
Verify removal:
# Check git history git log --all --full-history -- config.yaml -
Update .gitignore:
- Ensure
config.yamlis in.gitignore - Verify it's working:
git statusshould not showconfig.yaml
- Ensure
- ✅
config.yaml- Contains real API keys - ✅
*.csv- Output files - ✅
debug_logs/- Log files - ✅
*.log- Log files - ✅
data/flights_cache/- Flight cache (may contain data) - ✅
.venv/- Virtual environment
- ✅
config.yaml.example- Only placeholders - ✅
data/destinations_cache/*.json- Only destination data (no credentials) - ✅
data/airport_names.json- Public data - ✅
data/airline_names.json- Public data ⚠️ data/destinations_cache/*.json- Cache files (review if needed)
- ✅
config.yamlis properly ignored - ✅ Only example config is tracked
⚠️ Consider moving cache files to.gitignoreif they grow large- ✅ All source code uses config file (no hardcoded keys)
- Never commit
config.yaml- It contains your real API credentials - Always use
config.yaml.example- This is the template with placeholders - Review cache files - They're currently tracked; ensure they don't contain sensitive data
- Check before pushing - Run the manual checklist before each push
- Use environment variables - For CI/CD, use environment variables instead of config files