From 8e6dfd785f1550dbe03bda7cbaca2a1bd3a5f70b Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Tue, 13 Oct 2026 15:59:36 +1100 Subject: [PATCH] fix(webui): channel reload route is authorized as the channel action Issue: archie-core-4laa1 --- internal/webui/authorize.go | 2 +- internal/webui/authorize_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/webui/authorize.go b/internal/webui/authorize.go index 97a0506bb..33d193876 100644 --- a/internal/webui/authorize.go +++ b/internal/webui/authorize.go @@ -295,7 +295,7 @@ func routeOverride(action access.Action, path string) (access.Action, access.Res return access.ActionUpdate, access.KindSecret, "", true case matchPrefix(path, "/api/harness/bindings"): return access.ActionRead, access.KindSecret, "", true - case matchPrefix(path, "/api/channels/"): + case matchPrefix(path, "/api/channels"): return actionManage(action), access.KindDashboard, segmentValue(path, 2), true case matchPrefix(path, "/api/config"), matchPrefix(path, "/api/logs"), // A person's own tokens act only as that person, so managing them diff --git a/internal/webui/authorize_test.go b/internal/webui/authorize_test.go index e50d8f8f2..9d12d2cdd 100644 --- a/internal/webui/authorize_test.go +++ b/internal/webui/authorize_test.go @@ -209,6 +209,14 @@ func TestAdministrationRoutes(t *testing.T) { } } +func TestChannelReloadRoute(t *testing.T) { + req := httptest.NewRequestWithContext(t.Context(), http.MethodPost, "/api/channels/telegram/reload", nil) + action, kind, key := accessRequest(req) + if action != access.ActionManageIdentities || kind != access.KindDashboard || key != "telegram" { + t.Fatalf("accessRequest = %q on %q (%q), want %q on %q (telegram)", action, kind, key, access.ActionManageIdentities, access.KindDashboard) + } +} + func TestPersonalTokensWithoutPerson(t *testing.T) { for _, method := range []string{http.MethodGet, http.MethodPost, http.MethodDelete} { t.Run(method, func(t *testing.T) {