fix(security): include webhook endpoint secrets in encryption key rotation

オープン
#764 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
77/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
next.js, typescript

調査の方向性

Start with src/lib/crypto/rotation.ts and its tests; trace how the existing sealed tables are read, re-encrypted, and counted, then inspect webhookEndpointSecretAad in src/lib/data/webhook-endpoints.ts. Add coverage for rotating an endpoint secret and delivering with only the new key, and update the Key rotation section of docs/operations/deploy.md to list every sealed table. Done means the rotation counts and re-encrypts endpoint secrets and the documented table list is complete.

索引モデルが issue の本文から書いたものです。

説明

area: security bug impact: medium priority: P2 size: S

Context

Found by the Fable pre-production review on 2026-12-02 (main at cedc1914; every line reference below re-checked on main at cde5aa3b). Source: security and privacy readiness report, new issue 4.

npm run keys:rotate re-encrypts only two tables: sealedTables covers connection_credentials and notification_destination_secrets (src/lib/crypto/rotation.ts:43-111). Per-connection webhook endpoint secrets are sealed with the same key (sealSecret, src/lib/data/webhook-endpoints.ts:107-109) and are not rotated. An unreadable secret logs webhook_endpoint.secret_unreadable and returns null (webhook-endpoints.ts:209-212), which the webhook route answers with 404 (src/lib/webhooks/receive.ts:163-167). The procedure removes the old key once the script reports nothing remaining (docs/operations/deploy.md:294-300).

Impact: after a rotation and removal of the old key, every Polar, Resend, and GitLab per-connection delivery gets 404 and the script output shows nothing wrong; the timeline silently stops receiving those events until each connection's webhook is set up again. After a rotation prompted by a compromise, those secrets stay sealed under the compromised key.

Plan

  1. Add webhook_endpoints to sealedTables, with the same read, re-encrypt, and count steps as the other two, using its associated data (webhookEndpointSecretAad).
  2. Count it in "remaining", so the script never reports done while an endpoint secret is under an old key.
  3. List every sealed table in deploy.md "Key rotation".

Acceptance criteria

  • npm run keys:rotate re-encrypts webhook_endpoints secrets and counts them in "remaining".
  • A test rotates an endpoint secret, removes the old key, and verifies a delivery under the new key only.
  • deploy.md "Key rotation" lists every sealed table.
  • Playwright e2e: none needed, no screen changes.

Files and areas

src/lib/crypto/rotation.ts, its tests, docs/operations/deploy.md (Key rotation).

Non-goals: rotating other secrets, the incident runbook (separate issue).

Verification

npm run typecheck, npm run lint, npx vitest run src/lib/crypto src/lib/data.


Branch: <issue-number>-rotate-webhook-secrets

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

主要言語
TypeScript
スター
13
フォーク
2
平均マージ
5時間 20分
マージ済み PR(30日)
287

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eddiejaoude/StackDash のほかの issue

eddiejaoude/StackDash の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。