fix(secret-scan): replace literal postgres creds with placeholders#221
Open
jamesbroadhead wants to merge 1 commit into
Open
fix(secret-scan): replace literal postgres creds with placeholders#221jamesbroadhead wants to merge 1 commit into
jamesbroadhead wants to merge 1 commit into
Conversation
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
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
Two pre-existing values were tripping the gitleaks
postgres-connection-stringrule on every secret-scan run, blocking unrelated pushes/PRs:.github/workflows/e2e-chatbot-app-next/playwright.yml— the CI postgres servicePOSTGRES_URLwas 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.e2e-chatbot-app-next/.env.example— the commented placeholderusername:password@host:port/databasehad 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@hostis 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.tomlagainst the working tree →no leaks found(was 2 leaks before).POSTGRES_URLresolves to the same literal value at workflow runtime via${{ format() }}).This pull request and its description were written by Isaac.