Check the Stage 12 database role's table privileges before each deploy
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 1
- Forks
- 1
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 61
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/policyengine-sim-api
-
Update policyengine to 6.7.3Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 Medio día Aptitud para principiantes 70/100
PolicyEngine/policyengine-sim-api#823 ·
Los mantenedores suelen responder en 1 día
-
Integration tests fail due to missing UV virtual environment setupPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
PolicyEngine/policyengine-sim-api#314 ·
Los mantenedores suelen responder en 1 día
-
Update policyengine to 6.10.1Posiblemente ocupada @policyengine la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 20/100
PolicyEngine/policyengine-sim-api#905 ·
Los mantenedores suelen responder en 1 día
-
Calculate a household under several policies in one call on Modal (v2 household functions)Posiblemente ocupada @anth-volk la tomó hoy. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
PolicyEngine/policyengine-sim-api#902 ·
Los mantenedores suelen responder en 1 día
-
Add simulation and report definitions to the simulation schemaPosiblemente ocupada @anth-volk la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
PolicyEngine/policyengine-sim-api#899 ·
Los mantenedores suelen responder en 1 día
Todos los issues de PolicyEngine/policyengine-sim-api
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
khuisman/mcp-gee-sweet#1166 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
lugassawan/swe-workbench#823 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
gramaziokohler/compas_timber#870 ·
-
security-scan-failure
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
semantica-agi/semantica#2089 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
autowarefoundation/autoware_carla_scenario#500 ·
Los mantenedores suelen responder en 1 día