Remove committed secrets; read config from env vars and add gitleaks guards - #939
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 (v8.30.1) found hardcoded secrets committed on
main. This PR removes them from the working tree, wires the code to read from environment variables / GitHub Actions secrets with fail-fast behaviour, and adds pre-commit + CI gitleaks gates so they cannot be re-committed.Findings (values redacted)
Working-tree scan (5 leaks):
.github/workflows/deploy.yml:15-16AKIA****/****).github/workflows/deploy.yml:23xoxb-****).github/workflows/deploy.yml:29ghp_****).github/workflows/deploy.yml:35sk_live_****)backend/src/config/production.js:14****), plus Postgres URL with embedded password (line 19) and SendGrid API key (line 22)History scan (10 leaks): the above, plus history-only leaks in
k8s/secret.yamland.github/workflows/sonar-devin-fix.yml(files no longer in the tree).backend/.envis not tracked (onlybackend/.env.example);frontend/.envwas tracked but contained only the non-secretVITE_API_URL.Changes
.github/workflows/deploy.yml: literals ->${{ secrets.AWS_ACCESS_KEY_ID }},${{ secrets.AWS_SECRET_ACCESS_KEY }},${{ secrets.SLACK_BOT_TOKEN }},${{ secrets.RELEASE_TAGGING_PAT }},${{ secrets.STRIPE_SECRET_KEY }}(these repo secrets must be created for the deploy workflow to keep working).backend/src/config/production.js: each secret becomes a lazy getter backed byrequireEnv(name), which throwsMissing required environment variable: <name>— no fallback literals.backend/.env.example: placeholders added forDATABASE_URLandSENDGRID_API_KEY(JWT_SECRETplaceholder already present)..gitignore/frontend/.gitignore: ignore.env,.env.*,*.env, keep!*.env.example;frontend/.envuntracked..pre-commit-config.yaml:gitleaks/gitleakshook pinned tov8.30.0..github/workflows/gitleaks.yml: runs the gitleaks CLI (detect --no-git --redact --exit-code 1) on push and pull_request; fails the build on any leak. Uses the CLI rather thangitleaks-action(which requires a paid org license) and scans the working tree only because history still contains the leaks until it is purged.Post-fix
gitleaks detect --no-gitis clean; backend tests (161) and frontend lint pass.Rotation required
All leaked credentials must be treated as compromised and rotated — they remain in git history (e.g. commit
f278c67). This PR only stops them being present going forward; history purging (git filter-repo/BFG + force push) should be done separately once rotation is complete.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/a68b5b502bce4757bfe29756aae98864
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/a68b5b502bce4757bfe29756aae98864?variant=devin