feat: Enforce API token scopes from the route map

Keyed on the registered gin route pattern rather than a per-route
decorator, because a route registered without a decorator would be
unguarded. An unmapped route reached by a token is a 403, and a boot-time
check refuses to start when any /api route is missing, so the failure
lands at deploy rather than as a customer's surprise 403.
This commit is contained in:
2026-08-12 14:40:00 +00:00
parent 2f60b81962
commit be4f488db3
3 changed files with 217 additions and 0 deletions
+4
View File
@@ -234,6 +234,10 @@ func serve() {
r.Use(corsMiddleware())
api.RegisterRoutes(r)
if err := api.AssertScopeMapComplete(r); err != nil {
log.Fatalf("api scope map: %v", err)
}
srv := &http.Server{Addr: ":8080", Handler: r}
go func() {
log.Println("REST server listening on :8080")