#333 Update gen-postfix-conf.sh and replace hardcoded Thunder credentials #334
Conversation
…and-EXPN-commands Update gen-postfix-conf.sh
Changes the thunder-auth.sh authentication payload to read THUNDER_ADMIN_USERNAME and THUNDER_ADMIN_PASSWORD from environment variables, falling back to "admin" defaults if not set.
…under-credentials fix: replace hardcoded Thunder admin credentials with env vars
There was a problem hiding this comment.
Pull request overview
This PR updates the Thunder authentication helper script to avoid hardcoded admin credentials by allowing deployments to supply THUNDER_ADMIN_USERNAME / THUNDER_ADMIN_PASSWORD via environment variables (with admin/admin as defaults for backward compatibility).
Changes:
- Replaced hardcoded
"username":"admin","password":"admin"in the Thunder/flow/executeauthentication payload with${THUNDER_ADMIN_USERNAME:-admin}and${THUNDER_ADMIN_PASSWORD:-admin}.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request updates the authentication script to use environment variables for admin credentials instead of hardcoded values. Feedback was provided to improve the robustness of the JSON payload by properly escaping special characters in the username and password to prevent potential malformed requests.
📌 Description
The
thunder_authenticate()function inscripts/utils/thunder-auth.shsent hardcoded"username":"admin","password":"admin"in the authentication JSON payload to Thunder. This meant credentials were visible in source code and couldn't be customized per-deployment without modifying the script.🔍 Changes Made
"username":"admin","password":"admin"inscripts/utils/thunder-auth.sh:112with${THUNDER_ADMIN_USERNAME:-admin}and${THUNDER_ADMIN_PASSWORD:-admin}shell parameter expansionTHUNDER_ADMIN_USERNAMEandTHUNDER_ADMIN_PASSWORDare already defined inservices/.env.exampleandservices/.envadmin/admindefaults if env vars are not set✅ Checklist (Email System)
🧪 Testing Instructions
source scripts/utils/thunder-auth.shand verify script syntax is validthunder_authenticatewithout env vars set — payload should contain"username":"admin","password":"admin"THUNDER_ADMIN_USERNAME=customuser THUNDER_ADMIN_PASSWORD=securepass123— payload should contain"username":"customuser","password":"securepass123"THUNDER_ADMIN_USERNAMEset — password should fall back toadmin📷 Screenshots / Logs (if applicable)
Test results — env var substitution verified:
THUNDER_ADMIN_USERNAMETHUNDER_ADMIN_PASSWORD"username":"admin","password":"admin"customusersecurepass123"username":"customuser","password":"securepass123"anotheruser"username":"anotheruser","password":"admin"All three cases produce valid JSON. Script syntax check:
bash -n scripts/utils/thunder-auth.sh— OK..env.examplealready documents these variables — no doc update neededthunder-auth.sh:scripts/user/create_test_users.shandscripts/user/remove_test_users.sh— they will automatically pick up the env varsservices/.envwithout touching any script files