Check the Stage 12 database role's table privileges before each deploy
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
調査の方向性
Start by reading stage12-deploy.yml, simulation-deploy.reusable.yml, and rules/registry.toml, then inspect the persistence operations described for the two comparison-run tables. Trace the Stage 12 role's connection URL through each environment's secrets and the reusable workflow inputs. Done means the pre-deploy transaction checks each required operation, rolls back, and fails with the table and operation named when a permission is missing.
索引モデルが issue の本文から書いたものです。
説明
Problem
The simulation API and its Modal worker write the temporary comparison-run tables, stage12_evaluation_reports and stage12_evaluation_simulations, in the v2 Supabase database as policyengine_stage12_staging or policyengine_stage12_production, through libs/policyengine-stage12-persistence. Nothing in this repository checks, before a deploy, that the role can do what that code does.
The Public API had the same gap. In PolicyEngine/policyengine-api#3977, production's runtime role had no SELECT on a table one route read, and every reform save returned 503. CI ran as the database superuser, so no test could fail on it.
PolicyEngine/policyengine-api#3980 (PR PolicyEngine/policyengine-api#3985) now declares every managed role's table privileges in the Public API repository, in policyengine_api/data/v2/privileges.py. The Stage 12 role is declared to hold SELECT, INSERT, UPDATE and DELETE on the two comparison-run tables and nothing else. The Public API's deploy grants those privileges after each v2 schema upgrade and checks them. That deploy runs separately from this repository's stage12-deploy.yml, so a simulation API deploy can still start with a role that lacks a privilege its code needs: for example, when the persistence library starts a new kind of operation, or when grants are changed by hand.
Proposal
-
A rule in
rules/registry.toml, for examplesim.stage12.role-privileges-checked-before-deploy: a deploy of the Stage 12 path doesn't start until the Stage 12 role has passed the check below. -
A check before the deploy steps in
stage12-deploy.yml(orsimulation-deploy.reusable.ymlwhendeploy_stage12_v2is true). It connects as the Stage 12 role and, in one transaction that is always rolled back, runs each operationpolicyengine-stage12-persistenceperforms on the two tables:- insert a report and a simulation with
ON CONFLICT DO NOTHING ... RETURNING; - select them, including with
FOR UPDATE; - update them.
Any permission error fails the deploy and names the table and operation. No row survives the check.
- insert a report and a simulation with
-
Proof: a role without UPDATE on
stage12_evaluation_simulationsfails the check; the declared role passes. -
Environment variables: name the secret that holds the Stage 12 role's connection URL for each environment, and confirm it reaches the new step (environment
secrets:, reusable-workflowsecrets: inherit, stepenv:).
Related
- PolicyEngine/policyengine-api#3980 and PolicyEngine/policyengine-api#3985: declared privileges, the grant-and-verify deploy step, and integration tests that run the Public API's comparison-run services (
policyengine_api/services/v2/comparison_runs) aspolicyengine_stage12_test. - PolicyEngine/policyengine-api#3977: the production incident.
- 主要言語
- Python
- スター
- 1
- フォーク
- 1
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 60
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine-sim-api のほかの issue
-
Update policyengine to 6.7.3再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 半日 初心者へのやさしさ 70/100
PolicyEngine/policyengine-sim-api#823 ·
メンテナーはふだん 1 日以内に返信
-
Integration tests fail due to missing UV virtual environment setup対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
PolicyEngine/policyengine-sim-api#314 ·
メンテナーはふだん 1 日以内に返信
-
Staging deployments do not promote their tested Simulation Entrypoint revision対応中かも @anth-volk が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
PolicyEngine/policyengine-sim-api#893 ·
メンテナーはふだん 1 日以内に返信
-
Daily dependency update fails: merging main into the update branch produces a uv.lock that uv cannot parse対応中かも @anth-volk が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
PolicyEngine/policyengine-sim-api#889 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
PolicyEngine/policyengine-sim-api#884 ·
メンテナーはふだん 1 日以内に返信
PolicyEngine/policyengine-sim-api の issue をすべて見る
似ている issue
-
resource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
hesreallyhim/awesome-claude-code#3214 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
room-commons replace accepts an empty old string and silently prepends the new text to the pageオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
doobidoo/mcp-memory-service#1650 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ml-explore/mlx-lm#2002 ·
メンテナーはふだん 2 日以内に返信