A failed database query logs its parameters, so OAuth tokens and participant details can end up in the logs
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
What happens
When a query fails, Drizzle wraps the error in a DrizzleQueryError whose message is Failed query: <sql>\nparams: <every bind value>, with the same values in stack and an enumerable params field. The app logs these errors whole:
provider.on('server_error')insrc/oauth/provider.tslogs{ err }. oidc-provider stores opaque refresh tokens and authorization codes under their own value as the adapter id, andDrizzleOidcAdapter(src/oauth/adapter.ts) queriesoauth_recordsby that id. So a token refresh that hits a database hiccup writes a live refresh token (30-day lifetime) into the log line.handle()insrc/lib/api-response.tslogs{ err: e }for any unhandled route error. A failed participant or commitment insert incommitParticipantToSlotlogs the participant's email, name and notes.
src/lib/log.ts redacts by key name only (*.token, *.password, …), so nothing touches err.message, err.stack or err.params. The code already knows about this: keyErrorSummary in src/oauth/keys.ts works around it for signing-key queries, and only there.
This is hardening. It needs a database fault plus access to the logs, but anyone who can read the logs could then reuse a refresh token, and participant details land in whatever collects the logs.
Fix, in outline
- One
errserializer insrc/lib/log.ts. When the error is aDrizzleQueryError, log it as the query text plus the driver's own error (causemessage andcode), never the params. Everything else goes throughpino.stdSerializers.erras now. - That covers every log site that uses the
errkey, including the two above. Check no log call passes a query error under a different key. keyErrorSummarycan stay, or reuse the same helper.
Watch for
- The Postgres error's own
detail. For a unique violation it can readKey (...)=(...) already exists, carrying column values. Leave outcause.detailtoo, or decide deliberately to keep it, and say which in the PR. - Pretty logs in dev.
pino-prettyuses the same serializers, so dev output changes the same way. That's fine. - CLAUDE.md "Logging" says to extend
redact.pathsfor new secret-shaped fields. Add a line saying query errors are logged without their params.
Done when
- A unit test logs a fake
DrizzleQueryError(params likeFAKE_TOKENand[email protected]) through the real logger and asserts neither value appears in the output, while the query text and the driver's message do. pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm testpass.
Found by the pipeline's security scout in OAuth, logging and the participant commit path, at f7ce6df. Checked by an independent run that sent a refresh-token lookup and a participant insert to a dead database through the real adapter, handle() and log.ts in production mode, and saw the fake token, email and name in the JSON log lines. https://claude.ai/code/session_016YZ9SUoktNabfXNaSwoFiG
- Lingua principale
- TypeScript
- Stelle
- 19
- Fork
- 4
- Merge medio
- 19h 38m
- PR unite (30g)
- 197
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di richshaw/OpenSignup
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
richshaw/OpenSignup#794 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement pipeline:proposed pipeline:ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
richshaw/OpenSignup#654 ·
I maintainer di solito rispondono entro 1 giorno
-
Two breadcrumb pages belong to URLs that always redirect, so they never showForse già presa @richshaw l’ha presa 1 giorno fa. Apertaenhancement good first issue pipeline:stuck
richshaw/OpenSignup#793 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
A failed "Turn reminders back on" reloads the page with no errorForse già presa @ShahadatTest l’ha presa 2 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
richshaw/OpenSignup#785 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
The Build tab lets a list get a 21st item or one over 60 characters, then rolls it back with a cryptic errorForse già presa @richshaw l’ha presa 2 giorni fa. Apertabug pipeline:building pipeline:ux
richshaw/OpenSignup#784 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di richshaw/OpenSignup
Issue simili
-
Navbar avatar and name stay stale after saving profile changesForse già presa @alexechoi l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
marmelab/atomic-crm#416 ·
I maintainer di solito rispondono entro 1 giorno
-
feature-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
bluesky-social/social-app#12343 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
lucide-icons/lucide#5165 ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature] Preferences - Keep the theme selection popover open after selection for quick previewAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
marktext/marktext#6033 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:desktop bug has repro platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
anthropics/claude-code#107903 ·