mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-18 00:17:39 +01:00
Harden apply-restart auth for proxy/OIDC
This commit is contained in:
@@ -798,7 +798,10 @@ func (r *Router) setupRoutes() {
|
||||
if req.Method == http.MethodPost {
|
||||
// SECURITY: Require authentication - this endpoint can trigger service restart (DoS risk)
|
||||
// Allow if: (1) auth is not configured yet (initial setup), or (2) caller is admin-authenticated
|
||||
authConfigured := r.config.AuthUser != "" && r.config.AuthPass != "" || r.config.HasAPITokens()
|
||||
authConfigured := (r.config.AuthUser != "" && r.config.AuthPass != "") ||
|
||||
r.config.HasAPITokens() ||
|
||||
r.config.ProxyAuthSecret != "" ||
|
||||
(r.config.OIDC != nil && r.config.OIDC.Enabled)
|
||||
if authConfigured {
|
||||
if !CheckAuth(r.config, w, req) {
|
||||
log.Warn().
|
||||
|
||||
@@ -1965,7 +1965,6 @@ func TestProxyAuthNonAdminDeniedAdminEndpoints(t *testing.T) {
|
||||
{method: http.MethodDelete, path: "/api/agents/kubernetes/clusters/cluster-1", body: ``},
|
||||
{method: http.MethodPost, path: "/api/agents/host/link", body: `{}`},
|
||||
{method: http.MethodPost, path: "/api/agents/host/unlink", body: `{}`},
|
||||
{method: http.MethodDelete, path: "/api/agents/host/agent-1", body: ``},
|
||||
{method: http.MethodGet, path: "/api/admin/profiles/", body: ""},
|
||||
{method: http.MethodPost, path: "/api/agent-install-command", body: `{}`},
|
||||
{method: http.MethodPost, path: "/api/setup-script-url", body: `{}`},
|
||||
|
||||
Reference in New Issue
Block a user