Skip to content

control-plane-api: update_l2_reporting gates ops admin via Snapshot - #3436

Open
bbartman wants to merge 2 commits into
bmb/strangle-1-create-data-planefrom
bmb/strangle-2-update-l2-reporting
Open

control-plane-api: update_l2_reporting gates ops admin via Snapshot#3436
bbartman wants to merge 2 commits into
bmb/strangle-1-create-data-planefrom
bmb/strangle-2-update-l2-reporting

Conversation

@bbartman

Copy link
Copy Markdown
Contributor

Part 2 of the 3-PR stack strangling the last reachable Rust call sites of internal.user_roles(). Stacked on #3435.

Plan

With #3435 having migrated /admin/create-data-plane and established the shared gate (evaluate_names_authorization(snapshot, claims, Admin, ["ops/"]) through Envelope::authorization_outcome), this PR applies the identical swap to /admin/update-l2-reporting — the second of the three remaining call sites. The third (the storage-mappings directive) follows in the final PR, which threads the agent's snapshot_watch into DirectiveHandler.

This change

  • update_l2_reporting drops its internal.user_roles() SQL gate for the shared Snapshot policy. Denials gain the standard authorization-retry protocol (early Snapshot refresh + 307 retry on possible staleness), and the ancestor-subject grant walk applies — the deliberate semantic change pinned by test_evaluate_ops_admin_ancestor_subject_chain in control-plane-api: create_data_plane gates ops admin via Snapshot #3435.
  • This removes the last caller of the exact query text select role_prefix from internal.user_roles($1, 'admin') where role_prefix = 'ops/', so cargo sqlx prepare drops its orphaned offline-cache entry. Two live_specs query-metadata files also regenerated with updated column nullability against current migrations (deliberate: full-prepare was chosen over hand-deleting the orphan; CI's sqlx-check arbitrates).

Tests

Denial-path endpoint tests mirror create-data-plane's (no bearer → 401, non-ops-admin → terminal 403 with the standard message). With the gate's policy shared and unit-tested in #3435, per-endpoint wiring is the remaining regression surface — which is exactly what these pin. Allowed cases (including the ancestor chain) stay in the shared gate's unit tests; no success-path endpoint test, since an authorized request proceeds into the L2 template publication, out of scope for authorization tests.

@bbartman
bbartman force-pushed the bmb/strangle-2-update-l2-reporting branch from 2a5d039 to 26973b3 Compare August 28, 2026 17:48
@bbartman
bbartman force-pushed the bmb/strangle-2-update-l2-reporting branch from 26973b3 to 3064cfd Compare August 31, 2026 14:05
Swap the endpoint's internal.user_roles() SQL gate for the same
evaluate_names_authorization policy over the pinned Snapshot that
create-data-plane now uses, evaluated through
Envelope::authorization_outcome. Denials gain the standard retry
protocol, and the ancestor-subject grant walk applies (see the pinned
gate tests in the parent module).

This removes the last caller of the exact user_roles query text, so
`cargo sqlx prepare` drops its orphaned offline-cache entry. The two
live_specs metadata files also regenerated with updated column
nullability against current migrations.

Denial-path endpoint tests mirror create-data-plane's: with the gate's
policy shared, per-endpoint wiring is what remains to regress.
@bbartman
bbartman force-pushed the bmb/strangle-2-update-l2-reporting branch from 3064cfd to 15825d2 Compare September 1, 2026 12:02
Regenerating the query cache reverts two entries this branch had no
business touching: the connector_status nullability flag in the
live-specs status queries. Both columns are aliased with sqlx's `?`
force-nullable override, so the flag never reached the generated types
-- it was pure metadata drift from a prepare run against a differently
migrated database, and it would fail `ci:sqlx-check`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant