Remove committed secrets and add gitleaks pre-commit + CI gate - #942
Open
devin-ai-integration[bot] wants to merge 4 commits into
Open
devin-ai-integration[bot] wants to merge 4 commits into
devin-ai-integration[bot] wants to merge 4 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 5 hardcoded secrets in the working tree (10 in git history). This PR removes them from the code going forward and adds guards so they cannot be re-committed. All leaked values must still be rotated — they remain in git history until a separate history purge.
What was found (values redacted)
Working tree (gitleaks
--no-git, v8.30.1):.github/workflows/deploy.yml:16AWS_SECRET_ACCESS_KEY: ****).github/workflows/deploy.yml:23xoxb-****).github/workflows/deploy.yml:29ghp_****).github/workflows/deploy.yml:35sk_live_****)backend/src/config/production.js:14JWT_SECRET: '****'), plus Postgres URL with password and SendGrid key on adjacent linesHistory-only (already removed from the tree, still in commits):
k8s/secret.yaml:14,.github/workflows/sonar-devin-fix.yml:44,64, and earlier revisions ofproduction.js.backend/.envis already gitignored and untracked.frontend/.envwas tracked but only held the non-secretVITE_API_URL; it's removed here so no.envfile is tracked.Changes
deploy.yml: literal values ->${{ secrets.AWS_ACCESS_KEY_ID }},${{ secrets.SLACK_BOT_TOKEN }},${{ secrets.GH_DEPLOY_TOKEN }},${{ secrets.STRIPE_SECRET_KEY }}etc.backend/src/config/production.js: hardcoded literals replaced with a fail-fast reader — no default secret fallback:.gitignore(root) +frontend/.gitignore: ignore.env,.env.*,*.env; keep!.env.example/!*.env.example.backend/.env.example: placeholder entries forDATABASE_URLandSENDGRID_API_KEY(JWT_SECRET etc. already present) — placeholders only..pre-commit-config.yaml:gitleaks/gitleakshook pinned tov8.30.1..github/workflows/gitleaks.yml: runs the gitleaks CLI (--no-git --exit-code 1) on push and pull_request. Uses the CLI rather thangitleaks-actionbecause the action requires a paidGITLEAKS_LICENSEfor org repos. Scans the working tree only, since history still contains the old leaks and would fail every build until purged.Rotation required
Treat every value above as compromised: rotate the AWS key pair, Slack bot token, GitHub PAT, Stripe live key, JWT secret, Postgres password, and SendGrid key, then store the new values in GitHub Actions secrets / the deployment environment. Purging git history (
git filter-repo) is a separate follow-up.Verification
gitleaks detect --no-git: no leaks found.cd backend && npm test: 161 passed.cd frontend && npm run lint: clean.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/9461e403807b4d2f8b7e9bddd64dc584
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/9461e403807b4d2f8b7e9bddd64dc584?variant=devin