|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
echo "๐จ SECURITY: Regenerating .env file with new secrets" |
|
echo "=========================================================" |
|
|
|
|
|
if [ -f .env ]; then |
|
echo "๐ Backing up current .env to .env.backup" |
|
cp .env .env.backup |
|
fi |
|
|
|
|
|
echo "๐ Creating new .env from template" |
|
cp .env.example .env |
|
|
|
echo "" |
|
echo "๐ง REQUIRED ACTIONS:" |
|
echo "===================" |
|
echo "" |
|
echo "1. ๐ Generate new GitHub Personal Access Token:" |
|
echo " โ Go to: https://github.com/settings/tokens" |
|
echo " โ Generate new token (classic)" |
|
echo " โ Select required scopes: repo, workflow, admin:org" |
|
echo " โ Replace 'ghp_your_github_personal_access_token' in .env" |
|
echo "" |
|
echo "2. ๐ Generate new Google Cloud Service Account:" |
|
echo " โ Go to: https://console.cloud.google.com/iam-admin/serviceaccounts" |
|
echo " โ Create new service account" |
|
echo " โ Download JSON key file" |
|
echo " โ Store as 'service-account-key.json' (NOT in git)" |
|
echo " โ Update GOOGLE_APPLICATION_CREDENTIALS path in .env" |
|
echo "" |
|
echo "3. ๐ Update other API keys if compromised:" |
|
echo " โ Groq API key" |
|
echo " โ HuggingFace token" |
|
echo " โ Any other sensitive tokens" |
|
echo "" |
|
echo "4. ๐ Edit .env file with your actual values" |
|
echo "" |
|
echo "5. โ
Verify .env is in .gitignore (already done)" |
|
echo "" |
|
echo "โ ๏ธ NEVER commit the .env file to version control!" |
|
echo "โ ๏ธ The exposed tokens have been invalidated and must be regenerated!" |
|
|
|
echo "" |
|
echo "๐ง Next steps after updating .env:" |
|
echo "=================================" |
|
echo "1. Remove .env from git history: git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch .env' --prune-empty --tag-name-filter cat -- --all" |
|
echo "2. Force push (DANGEROUS): git push origin --force --all" |
|
echo "3. Test application: python app.py" |
|
echo "" |
|
echo "๐ง Contact your team to update any shared secrets!" |
|
|