Remove hardcoded secrets, read from env vars, and add gitleaks guards - #920
Open
devin-ai-integration[bot] wants to merge 3 commits into
Open
devin-ai-integration[bot] wants to merge 3 commits into
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Weekly gitleaks sweep found live secrets committed in the working tree (all values redacted here):
backend/src/config/production.js:7— hardcoded JWT signing secret (secret: '****')backend/src/config/production.js:11— Postgres connection string with embedded password (url: '****')backend/src/config/production.js:14— SendGrid API key (apiKey: '****').github/workflows/deploy.yml:15-16— AWS access key ID (AKIA****) + secret access key.github/workflows/deploy.yml:23— Slack bot token (xoxb-****).github/workflows/deploy.yml:29— GitHub PAT (ghp_****).github/workflows/deploy.yml:35— Stripe live secret key (sk_live_****)History-only findings (rotate, cannot be fixed by this PR): the same values in prior commits, plus
k8s/secret.yamland curl basic-auth in.github/workflows/sonar-devin-fix.ymlfrom since-removed files.Changes:
production.jsnow readsJWT_SECRET/DATABASE_URL/SENDGRID_API_KEYviarequireEnv()getters that throw when the env var is missing — no hardcoded fallbacks.deploy.ymlenv values replaced with${{ secrets.* }}references (AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,SLACK_BOT_TOKEN,RELEASE_TAGGING_PAT,STRIPE_SECRET_KEY) — these repo secrets must be configured for deploy to keep working.frontend/.env(non-secretVITE_API_URLonly;frontend/.env.examplealready documents it) and added root/frontend.gitignorerules ignoring all.envfiles while keeping!*.env.example.backend/.env.examplegains placeholders forDATABASE_URLandSENDGRID_API_KEY(placeholders only)..pre-commit-config.yamlwith thegitleaks/gitleakshook (revv8.30.0) and.github/workflows/gitleaks.ymlrunninggitleaks/gitleaks-action@v2on push and pull_request (fails the build on any leak).Rotation required: every secret listed above must be treated as compromised and rotated — they remain in git history. This PR removes them going forward; purging history (e.g.
git filter-repo) should be done separately after rotation.Verified:
gitleaks detect --no-gitis clean on this branch; backend tests (161 passed) and frontend lint pass.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/55dbdf86091d49eeb3bfbb26cd9495ed