Skip to content

Exempt GET /metrics from admin API auth - #30

Open
bartzon wants to merge 2 commits into
v0.9.30-shopify-patchesfrom
bartzon/v0.9.30-admin-metrics-auth-exempt
Open

Exempt GET /metrics from admin API auth#30
bartzon wants to merge 2 commits into
v0.9.30-shopify-patchesfrom
bartzon/v0.9.30-admin-metrics-auth-exempt

Conversation

@bartzon

@bartzon bartzon commented Sep 8, 2026

Copy link
Copy Markdown

Part of https://github.com/shop/issues-retail/issues/34482 (bugbounty 3990068 hardening, parent https://github.com/shop/issues-retail/issues/34436).

Why

We want to set LIBSQL_ADMIN_AUTH_KEY in production (the admin port serves AdminShell — arbitrary SQL on any namespace — and POST /v1/namespaces/:ns/config with jwt_key, i.e. install-your-own-signing-key). Today the key is unset, so auth_middleware in http/admin/mod.rs is a no-op.

Blocker: the middleware is layered onto the merged admin router, which includes GET /metrics, and our chart scrapes metrics on the admin port via prometheus.io/* annotations that cannot attach credentials. Setting the key as-is would 401 every scrape and blind the fleet.

What

GET /metrics bypasses admin auth; every other admin route stays guarded.

Base / release mechanics

  • Base branch v0.9.30-shopify-patches = tag libsql-rs-v0.9.30+connection-initialization-patch (upstream 0.9.30 + FULLMUTEX patch), matching what libsql-infrastructure's Dockerfile builds today.
  • After merge: tag the result (e.g. libsql-rs-v0.9.30+connection-initialization-patch+admin-metrics) and bump the clone ref in Shopify/libsql-infrastructure/libsql-server/Dockerfile + VERSION to cut a new image.
  • cargo check -p libsql-server passes.

Order in the #34482 sequence

Must land before the LIBSQL_ADMIN_AUTH_KEY enablement PR in Shopify/infrastructure.

CI notes

  • Extensions Tests was failing on any branch of this tag: the rust_suite crate has no committed lockfile, so each run fresh-resolved icu_* 2.3.0 (requires rustc 1.88) against the repo-pinned 1.85 toolchain. Fixed here by committing libsql-sqlite3/test/rust_suite/Cargo.lock with idna_adapter pinned to 1.1.0 (unicode-rs backend, drops icu from the graph entirely). Future PRs on this patch line inherit the fix.
  • connection_core::test::test_many_concurrent (Run Tests) is flaky on shared runners — it's upstream's lock-stealing stress test and its own doc comment says "If this test becomes flaky check out the lock stealing code." It fails/passes independent of this change (observed both across identical commits); retry on failure.
  • golang-bindings occasionally hits GitHub API rate limits in the toolchain action; retry on failure.

The admin listener serves both the admin API and Prometheus metrics.
Annotation-based scraping cannot attach credentials, so guarding
/metrics behind LIBSQL_ADMIN_AUTH_KEY would blind the fleet. Keep
GET /metrics open; all other admin routes remain guarded.
@bartzon bartzon self-assigned this Sep 8, 2026
@bartzon
bartzon marked this pull request as ready for review September 8, 2026 12:39
@bartzon
bartzon requested a review from a team September 8, 2026 12:40
The Extensions Tests job fresh-resolves rust_suite deps on every run;
icu 2.3.0 (via idna_adapter 1.2) now requires rustc 1.88 while the
repo pins 1.85.0, failing CI on any branch of this tag. Pinning
idna_adapter to 1.1.0 (unicode-rs backend) drops icu from the graph.
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