security: latch /admin group behind RequireAdmin (SEC-026)
The /admin group rode on webAuthMW + audit only; just the securitySettings sibling checked the role. Inert today (login mints role=admin), live the day RBAC lands — one group-level gate beats per-route annotations to forget.
This commit is contained in:
parent
7d47b0769d
commit
cc19854941
1 changed files with 6 additions and 0 deletions
|
|
@ -887,6 +887,12 @@ func main() {
|
|||
// Admin/Registration Token routes (for agent enrollment management)
|
||||
auditMW := middleware.NewAuditMiddleware(db.DB)
|
||||
admin := dashboard.Group("/admin")
|
||||
// Trust boundary latch (ETHOS 11.4): the /admin group requires the admin
|
||||
// role at the group level, not per-route. Inert today (login mints role
|
||||
// "admin" only, auth.go), but the day role issuance diversifies the gate
|
||||
// is already structurally correct — a non-admin can't reach any /admin
|
||||
// handler, and there's no per-route annotation to forget.
|
||||
admin.Use(middleware.RequireAdmin())
|
||||
admin.Use(auditMW.Audit())
|
||||
{
|
||||
admin.POST("/registration-tokens", rateLimiter.RateLimit("admin_token_gen", middleware.KeyByUserID), registrationTokenHandler.GenerateRegistrationToken)
|
||||
|
|
|
|||
Loading…
Reference in a new issue