Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: add SAML auth bypass and update route inventory tests

rcourtman2fb6ebc25f19
diff --git a/internal/api/route_inventory_test.go b/internal/api/route_inventory_test.go
index b66cdc37bf..df76d4acc7 100644
--- a/internal/api/route_inventory_test.go
+++ b/internal/api/route_inventory_test.go
@@ -212,6 +212,7 @@ var publicRouteAllowlist = []string{
"/api/security/quick-setup",
"/api/login",
"/api/oidc/login",
+ "/api/saml/",
"/api/ai/oauth/callback",
"/api/setup-script",
"/api/system/verify-temperature-ssh",
@@ -251,6 +252,7 @@ var bareRouteAllowlist = []string{
"/api/logout",
"/api/logs/level",
"/api/oidc/login",
+ "/api/saml/",
"/api/security/apply-restart",
"/api/security/change-password",
"/api/security/quick-setup",
@@ -371,6 +373,11 @@ var allRouteAllowlist = []string{
"/api/security/reset-lockout",
"/api/security/oidc",
"/api/oidc/login",
+ "/api/security/sso/providers",
+ "/api/security/sso/providers/test",
+ "/api/security/sso/providers/metadata/preview",
+ "/api/security/sso/providers/",
+ "/api/saml/",
"/api/security/tokens",
"/api/security/tokens/",
"/api/security/status",
diff --git a/internal/api/router.go b/internal/api/router.go
index 3a973032bd..f93868e411 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -3818,6 +3818,12 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
isPublic = true
}
+ // SAML login flow endpoints must be public (login, ACS callback, metadata, logout, SLO).
+ // These have dynamic provider IDs in the path so use prefix matching.
+ if strings.HasPrefix(normalizedPath, "/api/saml/") {
+ isPublic = true
+ }
+
// Dev mode bypass for admin endpoints (disabled by default)
if adminBypassEnabled() {
log.Debug().
diff --git a/internal/api/router_auth_bypass_inventory_test.go b/internal/api/router_auth_bypass_inventory_test.go
index 5fcc32b8a2..2b99506d04 100644
--- a/internal/api/router_auth_bypass_inventory_test.go
+++ b/internal/api/router_auth_bypass_inventory_test.go
@@ -52,8 +52,11 @@ func parseAuthBypassPaths(t *testing.T) []string {
}
block := src[start : start+end]
- re := regexp.MustCompile(`normalizedPath == "([^"]+)"`)
- matches := re.FindAllStringSubmatch(block, -1)
+ reExact := regexp.MustCompile(`normalizedPath == "([^"]+)"`)
+ rePrefix := regexp.MustCompile(`HasPrefix\(normalizedPath, "([^"]+)"\)`)
+
+ matches := reExact.FindAllStringSubmatch(block, -1)
+ matches = append(matches, rePrefix.FindAllStringSubmatch(block, -1)...)
if len(matches) == 0 {
t.Fatalf("no auth bypass paths found in router.go")
}
@@ -74,6 +77,7 @@ func parseAuthBypassPaths(t *testing.T) []string {
var authBypassAllowlist = []string{
"/api/auto-register",
+ "/api/saml/",
"/api/setup-script",
"/api/system/ssh-config",
"/api/system/verify-temperature-ssh",