fix(rees): require auth for /metrics and guard server startup - #5491
fix(rees): require auth for /metrics and guard server startup#5491JSONbored wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-12 23:23:14 UTC
⏸️ Suggested Action - Manual Review Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agent
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
Closing as a regression, not a fix. The premise — that REES's
More concretely, this would break already-shipped, same-day work: #5412 ( The code itself is clean and well-tested (the |
Motivation
/metricsendpoint was exposed without authentication and could be scraped remotely, revealing aggregate telemetry and analyzer health; the service needs to enforce the same shared-bearer auth used by its private API.appwithout starting a network listener so route-level tests can run in-process.Description
/metricsroute now checksnormalizeSharedSecret(process.env.REES_SHARED_SECRET)and callsverifyBearer(...)before returning Prometheus text viarenderMetrics()so unauthenticated scrapes are rejected.serve()and installing process signal handlers) are wrapped behind a direct-execution guard usingif (import.meta.url === pathToFileURL(process.argv[1] ?? "").href)so test imports do not open a listener.review-enrichment/test/server-metrics-auth.test.tsthat asserts unauthenticated scrapes receive401and authenticated scrapes receive metrics, and adjusted imports (pathToFileURL) needed for the startup guard.Testing
git diff --checkwhich produced no trailing-whitespace or conflict-marker errors and succeeded.npm run rees:testwhich completed with all tests passing.node --test --experimental-strip-types test/server-metrics-auth.test.tsand they passed locally.npm audit --audit-level=moderatebut the registry audit endpoint returned403in this environment, so the audit could not be completed here.Codex Task