This plugin routes prompts to locally installed CLIs (codex and gemini) using account-based authentication. The plugin itself does not store, manage, or require API keys.
✅ No API Key Storage: All authentication is handled by the CLI tools themselves ✅ Account-Based Auth: Uses your existing CLI sessions (codex login, gemini login) ✅ No Secrets in Code: Plugin code contains no hardcoded credentials ✅ Secure by Design: Zero-trust architecture for credential management
-
Never commit .env files
# Always in .gitignore .env .env.* *.env
-
Never embed tokens in git remote URLs
# ❌ WRONG git remote add origin https://ghp_token@github.com/user/repo.git # ✅ CORRECT git remote add origin https://github.com/user/repo.git
-
Never hardcode API keys in code
// ❌ WRONG const API_KEY = "sk-abc123..."; // ✅ CORRECT const API_KEY = process.env.OPENAI_API_KEY;
-
Never commit credentials to git history
- Even if deleted in later commits, they remain in git history!
- Use
git-filter-repoto clean history if this happens
-
Use environment variables for all secrets
cp .env.example .env # Edit .env with your actual values # .env is in .gitignore by default
-
Authenticate CLIs properly
# Codex codex login # Gemini gemini login # or equivalent for your Gemini CLI
-
Run security checks regularly
bash scripts/security-check.sh
-
Review .gitignore before commits
cat .gitignore | grep -E "env|secret|key|token"
This plugin uses a pass-through authentication model:
-
You authenticate with the CLI tools directly:
codex login # OpenAI/Codex gemini login # Google Gemini
-
CLI stores session locally (in their own secure storage)
-
Plugin invokes CLI which uses the stored session
-
No credentials are ever passed through or stored by this plugin
- Codex:
~/.config/codex/(or similar, managed by @openai/codex) - Gemini:
~/.config/gemini/(or similar, managed by gemini CLI)
Before every commit, verify:
- No
.envfiles are staged:git status | grep .env - No secrets in code:
bash scripts/security-check.sh - No tokens in remote URLs:
git remote -v - .gitignore is up to date
- All sensitive files are in .gitignore
Add this to .git/hooks/pre-commit:
#!/bin/bash
echo "🔐 Running security checks..."
# Check for .env files
if git diff --cached --name-only | grep -E "\.env$|\.env\."; then
echo "❌ ERROR: .env files are staged!"
echo "Remove with: git reset HEAD .env"
exit 1
fi
# Check for common secret patterns
if git diff --cached | grep -E "(ghp_|sk-|AKIA|AIza)"; then
echo "❌ ERROR: Potential secrets found in staged changes!"
echo "Review your changes and remove any secrets."
exit 1
fi
echo "✅ Security checks passed"
exit 0Make it executable:
chmod +x .git/hooks/pre-commitIf token is still valid:
# 1. ROTATE the credential immediately
# - GitHub: https://github.com/settings/tokens
# - OpenAI: https://platform.openai.com/api-keys
# - Gemini: https://aistudio.google.com/app/apikey
# 2. Remove from git remote URL
git remote set-url origin https://github.com/USER/REPO.git
# 3. Verify it's gone
git remote -vIf committed to git history:
# Install git-filter-repo
pip install git-filter-repo
# Remove all .env files from history
git filter-repo --path .env --invert-paths
# Remove specific patterns (e.g., API keys)
git filter-repo --replace-text <(echo "ghp_xxxx==>REDACTED")
# Force push (⚠️ destructive!)
git push --force --all origin# Check recent commits
git log --all -p | grep -E "(ghp_|sk-|password|token)"
# Check current files
grep -rE "(ghp_|sk-|password)" . --exclude-dir=.git
# Run full security scan
bash scripts/security-check.shDocument the incident:
- Date of exposure
- What was exposed
- Actions taken
- New credentials created
bash scripts/security-check.shThis checks for:
- Exposed secrets in files
- .env files not in .gitignore
- Tokens in git remote URLs
- Hardcoded credentials
- Staged sensitive files
- Secrets in git history
The repository includes a security workflow (.github/workflows/validate.yml) that:
- Scans for secrets on every push
- Validates .gitignore completeness
- Checks for exposed credentials
- Fails the build if issues are found
Consider using:
- TruffleHog:
truffleHog --regex --entropy=False . - GitGuardian: https://www.gitguardian.com/
- GitHub Secret Scanning: Enable in repo settings
- Gitleaks:
gitleaks detect --source .
-
Start clean
git clone <repo> cp .env.example .env # Edit .env with your values (never commit!)
-
Before every commit
bash scripts/security-check.sh git status | grep .env # Should be empty
-
Before every push
git log -p | grep -E "(password|token|key)" | head -20
Essential patterns in .gitignore:
# Environment
.env
.env.*
*.env
# Secrets
secrets.json
credentials.json
auth.json
token.json
# Keys
*.key
*.pem
*.p12
*.pfx
*_key
*_token
*_secretAlways use environment variables for sensitive data:
# .env (never committed)
GITHUB_TOKEN=ghp_actual_token_here
OPENAI_API_KEY=sk-actual_key_here
# .env.example (committed, safe)
GITHUB_TOKEN=ghp_your_token_here
OPENAI_API_KEY=sk-your_key_hereSet secrets in repository settings:
- Go to:
Settings→Secrets and variables→Actions - Click
New repository secret - Add each secret:
GITHUB_TOKEN(for releases, PR comments)NPM_TOKEN(if publishing to npm)
steps:
- name: Use secret
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Token is available but not exposed"Never echo or print secrets in workflows!
# ❌ WRONG
git add .env
git commit -m "Add environment config"
# ✅ CORRECT
# .env is in .gitignore, never staged
git add .env.example # Only commit the template# ❌ WRONG
git clone https://ghp_token@github.com/user/repo.git
# ✅ CORRECT
git clone https://github.com/user/repo.git
# Then configure credentials via:
git config credential.helper store
# Or use SSH keys// ❌ WRONG
// TODO: Use token ghp_abc123 for testing
// ✅ CORRECT
// TODO: Use token from environment variable GITHUB_TOKEN// ❌ STILL WRONG
const token = "ghp_abc123...xyz"; // Redacted
// ✅ CORRECT
const token = process.env.GITHUB_TOKEN;If you discover a security vulnerability:
- Do NOT open a public issue
- Email: [Your security contact email]
- Include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
We will respond within 48 hours and work with you to resolve the issue.
- Security patches are released immediately
- All users are notified via GitHub Security Advisory
- Critical vulnerabilities are disclosed after patch is available
- Update to latest version regularly:
git pull origin main
For production use, ensure:
- All secrets in environment variables or secure vaults
- .gitignore contains all sensitive file patterns
- Pre-commit hooks enabled and tested
- Security scanning in CI/CD pipeline
- No secrets in git history (verified)
- GitHub Secret Scanning enabled
- Dependabot alerts enabled
- Regular security audits scheduled
- Team trained on security best practices
- Incident response plan documented
Last Updated: 2025-11-17 Version: 1.0 Maintained By: Ralle1976 Contact: GitHub Issues