|
#!/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!" |
|
|