Skip to content

admin gate: a 405 Method-Not-Allowed answer leaks the existence of admin-surface paths while Admin:Enabled=falseΒ #635

Description

@genwave-radio

πŸ› Sighting (T351 review, 2026-08-28 β€” pre-existing, not introduced by the diff)

With Admin:Enabled=false, GET /api/announcements/token answers 405, not 404. Routing's method-not-allowed endpoint carries no AdminSurfaceAttribute metadata, so SurfaceGateMiddleware (src/GenWave.Host/Api/SurfaceGateMiddleware.cs) passes it through β€” the path's existence (and its allowed methods, via the Allow header) leaks on a box whose admin plane is supposed to "not exist" (F61.2). Any admin-surface route hit with a method it doesn't map reproduces it.

πŸ”§ Fix shape

Treat the framework's method-not-allowed / diagnostic endpoints the way FrameworkDiagnosticEndpointAuthorizationHandler already does for its class: when the matched route's candidates are all admin-surface and the admin plane is off, answer 404. Pin with a Story166-style fact: GET /api/announcements/token β†’ 404 with admin off (and 405 with admin on, unchanged).

Refs: F61.2 (the kill switch), T351 / SPEC F145.6 (the one deliberate carve-out), Story166_AdminKillSwitch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low prioritybugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions