A failed database query logs its parameters, so OAuth tokens and participant details can end up in the logs
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
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
- 主要言語
- TypeScript
- スター
- 19
- フォーク
- 4
- 平均マージ
- 19時間 27分
- マージ済み PR(30日)
- 199
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
richshaw/OpenSignup のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
richshaw/OpenSignup#794 ·
メンテナーはふだん 1 日以内に返信
-
enhancement pipeline:proposed pipeline:ux
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
richshaw/OpenSignup#654 ·
メンテナーはふだん 1 日以内に返信
-
Slot times are shown with their own copy of the HH:MM rule that saving them checks対応中かも @novakzx が今日担当しました。 オープンenhancement good first issue pipeline:ready
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
richshaw/OpenSignup#805 ·
メンテナーはふだん 1 日以内に返信
-
The sign-up dialog decides "See alternatives" with its own copy of the rule behind "Pick another slot."対応中かも @dafeiyupola が今日担当しました。 オープンenhancement good first issue pipeline:ready
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
richshaw/OpenSignup#803 ·
メンテナーはふだん 1 日以内に返信
-
Two breadcrumb pages belong to URLs that always redirect, so they never show対応中かも @richshaw が 2 日前に担当しました。 オープンenhancement good first issue pipeline:stuck
richshaw/OpenSignup#793 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
richshaw/OpenSignup の issue をすべて見る
似ている issue
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving Settings対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
area:ui bug effort:S priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Typo in WSL project description on Projects page対応中かも @akhil9tiet が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
microsoft/opensource.microsoft.com#1066 · コメント 1 件 ·
-
ArcGIS Maps SDK for JavaScript c-carousel calcite-design-tokens enhancement impact - p3 - not time sensitive needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Esri/calcite-design-system#15565 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
linkwarden/linkwarden#1891 ·
メンテナーはふだん 1 日以内に返信