fix(database): revoke the unused write grants on connections

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

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

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

評価

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

調査の方向性

Read the grants and RLS policies in supabase/migrations/20261031090100_integrations.sql, then review the connection writes in src/lib/connections/connect.ts and cooldown logic in supabase/migrations/20261031100000_sync_engine.sql. Add a migration and pgTAP coverage in supabase/tests/ for the specified grant changes, checking that rename remains allowed. Run npm run test:db and npm run db:types:check, then run the existing connections e2e spec to confirm rename, Sync now, and disconnect still work.

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

説明

area: database area: security bug impact: low priority: P3 size: XS

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 7.

authenticated may insert connections and update last_sync_requested_at (supabase/migrations/20261031090100_integrations.sql:173-175), but the app writes connections only through the admin client (src/lib/connections/connect.ts:162-164, :199-201), and the manual sync cooldown reads that column (supabase/migrations/20261031100000_sync_engine.sql:69-77; 300 s, MANUAL_SYNC_COOLDOWN_SECONDS, src/lib/jobs/queue.ts:21). No app code writes last_sync_requested_at with the user's client.

Impact: low. A workspace admin can set last_sync_requested_at to null through the Data API and request a sync again at once, skipping the cooldown, and can insert pending connection rows without limit. Both stay inside their own workspace.

Plan

  1. A migration revokes insert on public.connections and update (last_sync_requested_at) from authenticated, keeping update (display_name) for rename.
  2. Check the connections RLS policies and drop any insert policy that only served the grant.
  3. pgTAP pins the refusals and that rename still works.

Acceptance criteria

  • authenticated cannot insert a connection or update last_sync_requested_at (pgTAP).
  • Rename, Sync now, and disconnect still work (existing e2e specs pass).
  • Playwright e2e: no new spec; the existing connections specs cover the user paths.

Files and areas

One new migration, supabase/tests/ pgTAP, regenerated src/lib/supabase/database.types.ts if it changes.

Non-goals: other tables' grants.

Verification

npm run test:db, npm run db:types:check, the connections e2e spec.


Branch: <issue-number>-connections-write-grants

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 を短くまとめたダイジェスト。