Skip to content

feat(mgmt): add per-route scope enforcement on management HTTP port#118

Merged
hyp3rd merged 1 commit into
mainfrom
feat/dist-mem-cache
May 9, 2026
Merged

feat(mgmt): add per-route scope enforcement on management HTTP port#118
hyp3rd merged 1 commit into
mainfrom
feat/dist-mem-cache

Conversation

@hyp3rd
Copy link
Copy Markdown
Owner

@hyp3rd hyp3rd commented May 9, 2026

Introduce WithMgmtControlAuth option to apply a stricter auth gate (admin scope) to the cluster-mutating control endpoints (/evict, /clear, /trigger-expiration), while the observability surface (/stats, /config, /cluster/, /dist/) requires only read scope via WithMgmtAuth.

Key changes:

  • Extract Policy.Verify() from Middleware() so auth logic lives in one place; Middleware is now thin sugar over Verify() + Next(). Verify returns *fiber.Error (fail-closed) instead of SendStatus.
  • Add controlAuthFunc field and WithMgmtControlAuth option to ManagementHTTPServer; extract wrapWithGate helper shared by both auth wrappers.
  • Exempt /health from auth — k8s liveness probes carry no credentials and a probe failure cascades into pod-restart loops.
  • Wire read-or-better and admin-only gates in the server binary.
  • Add unit tests for Verify() parity with Middleware() and integration tests pinning the Phase C2 auth posture.

Introduce WithMgmtControlAuth option to apply a stricter auth gate
(admin scope) to the cluster-mutating control endpoints (/evict,
/clear, /trigger-expiration), while the observability surface
(/stats, /config, /cluster/*, /dist/*) requires only read scope
via WithMgmtAuth.

Key changes:
- Extract Policy.Verify() from Middleware() so auth logic lives in
  one place; Middleware is now thin sugar over Verify() + Next().
  Verify returns *fiber.Error (fail-closed) instead of SendStatus.
- Add controlAuthFunc field and WithMgmtControlAuth option to
  ManagementHTTPServer; extract wrapWithGate helper shared by both
  auth wrappers.
- Exempt /health from auth — k8s liveness probes carry no
  credentials and a probe failure cascades into pod-restart loops.
- Wire read-or-better and admin-only gates in the server binary.
- Add unit tests for Verify() parity with Middleware() and
  integration tests pinning the Phase C2 auth posture.
@hyp3rd hyp3rd self-assigned this May 9, 2026
@hyp3rd hyp3rd merged commit 9c1961c into main May 9, 2026
16 of 17 checks passed
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