Skip to content

fix(secret-scan): replace literal postgres creds with placeholders#221

Open
jamesbroadhead wants to merge 1 commit into
mainfrom
fix-secret-scan-postgres-literal
Open

fix(secret-scan): replace literal postgres creds with placeholders#221
jamesbroadhead wants to merge 1 commit into
mainfrom
fix-secret-scan-postgres-literal

Conversation

@jamesbroadhead
Copy link
Copy Markdown

Summary

Two pre-existing values were tripping the gitleaks postgres-connection-string rule on every secret-scan run, blocking unrelated pushes/PRs:

  1. .github/workflows/e2e-chatbot-app-next/playwright.yml — the CI postgres service POSTGRES_URL was a literal connection string. Wrapped in ${{ format('postgresql://{0}:{1}@...', 'postgres', 'postgres') }} so the source contains {/} (outside the user-char class in the gitleaks regex). GitHub Actions still produces the same effective env value at runtime.
  2. e2e-chatbot-app-next/.env.example — the commented placeholder username:password@host:port/database had every segment in the regex's allowed char classes. Switched to <username>:<password>@<host>:<port>/<database>, which breaks the match without changing the doc intent.

Why

The secret-scan pre-push hook checks each commit's diff. Once a commit containing a literal postgres://user:pass@host is merged, every future push that includes that commit in its scan range trips the rule — even when the push has nothing to do with postgres. This made docs-only PRs against the repo annoying.

Test plan

  • gitleaks detect --no-git -c gitleaks.toml against the working tree → no leaks found (was 2 leaks before).
  • CI still passes (the CI workflow's POSTGRES_URL resolves to the same literal value at workflow runtime via ${{ format() }}).

This pull request and its description were written by Isaac.

Two pre-existing values were tripping the gitleaks
`postgres-connection-string` rule on every secret-scan run.

1. The CI workflow at `.github/workflows/e2e-chatbot-app-next/playwright.yml`
   set `POSTGRES_URL` as a literal `postgresql://...` connection string for
   the postgres service container. Wrap it in
   `${{ format('postgresql://{0}:{1}@...', 'postgres', 'postgres') }}` so
   the source contains `{` / `}` (outside the user-char class in the
   gitleaks regex) while GitHub Actions still produces the same effective
   env value at runtime.

2. The commented placeholder in `e2e-chatbot-app-next/.env.example` used
   `username:password@host:port/database`, every segment of which is in
   the allowed char classes. Switch to `<username>:<password>@<host>:<port>/<database>`,
   which breaks the match without changing the doc intent.

Verified: gitleaks against the working tree reports no leaks after this
change.

Co-authored-by: Isaac
@jamesbroadhead jamesbroadhead requested a review from dhruv0811 May 27, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant