Restrict EXECUTE on the lane-provisioning SECURITY DEFINER functions and validate priority

Aperta
#677 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, rust
Ambito
database, security

Direzione di ricerca

Start by reading the 0.6.14 definer_lane_provisioning patch, v053 install, and docs/security.md; then locate queue_storage_canonical_triggers and the runtime grants. Check how the main migration should update these functions while preserving calls from released binaries using the runtime role. Done means only the runtime role can execute them, priorities outside 1–4 are rejected, and the trigger check allows the two built-in sequence sync triggers.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The definer_lane_provisioning patch (0.6.14) and v053 install provision_lane and provision_lane_sequences as SECURITY DEFINER functions owned by the schema owner, and grant EXECUTE on them to PUBLIC. Schema USAGE is therefore the only gate. Both functions validate only that the queue, priority and shard are non-null and that the shard is 0–63.

Consequences

  • Any role with schema USAGE, including read-only roles, can create owner-owned lanes and sequences for any queue name and any smallint priority. That allows catalog bloat and phantom lanes in admin views.
  • Their inserts into queue_lanes, queue_enqueue_heads and queue_claim_heads fire those tables' triggers as the schema owner. A role that holds TRIGGER on one of those tables and can create functions could have its own trigger function run as the owner. The documented grants exclude TRIGGER, and docs/security.md now warns against granting it.

Proposal

  • Grant EXECUTE only to the roles that can already write the head tables (the runtime group), not to PUBLIC.
  • Validate priority as 1–4.
  • Have provision_lane refuse to run when those tables carry any non-internal trigger other than the two built-in *_sequence_sync triggers, reusing queue_storage_canonical_triggers.

This needs a refreshed repeatable patch on 0.6 and a migration on main. Rolling upgrades must keep working: released binaries call the helpers as the runtime role.

Lingua principale
Rust
Stelle
37
Fork
8
Merge medio
14h 16m
PR unite (30g)
244

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hardbyte/awa

Tutte le issue di hardbyte/awa

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.