Check the Stage 12 database role's table privileges before each deploy
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 1
- Fork
- 1
- Merge medio
- 1g 16h
- PR unite (30g)
- 60
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 PolicyEngine/policyengine-sim-api
-
Update policyengine to 6.7.3Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
PolicyEngine/policyengine-sim-api#823 ·
I maintainer di solito rispondono entro 1 giorno
-
Integration tests fail due to missing UV virtual environment setupForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
PolicyEngine/policyengine-sim-api#314 ·
I maintainer di solito rispondono entro 1 giorno
-
Staging deployments do not promote their tested Simulation Entrypoint revisionForse già presa @anth-volk l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
PolicyEngine/policyengine-sim-api#893 ·
I maintainer di solito rispondono entro 1 giorno
-
Daily dependency update fails: merging main into the update branch produces a uv.lock that uv cannot parseForse già presa @anth-volk l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
PolicyEngine/policyengine-sim-api#889 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
PolicyEngine/policyengine-sim-api#884 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PolicyEngine/policyengine-sim-api
Issue simili
-
comp/tools P2 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NousResearch/hermes-agent#142908 · 1 commento ·
-
[oblt-aw][autodoc] Fix malformed headings in new Buildkite docs pagesForse già presa @github-actions l’ha presa oggi. Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offlineForse già presa @r2jaff l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ComposioHQ/composio#5054 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
pytorch/tensordict#3286 ·
I maintainer di solito rispondono entro 1 giorno