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.

Ensure public download endpoints bypass auth

rcourtman1fddbec07f64
diff --git a/internal/api/security_regression_test.go b/internal/api/security_regression_test.go
index b7e11b243e..f58ded1c78 100644
--- a/internal/api/security_regression_test.go
+++ b/internal/api/security_regression_test.go
@@ -2737,6 +2737,39 @@ func TestSetupScriptIsPublicEvenWhenAuthConfigured(t *testing.T) {
}
}
+func TestPublicDownloadEndpointsBypassAuth(t *testing.T) {
+ cfg := newTestConfigWithTokens(t)
+ cfg.AuthUser = "admin"
+ cfg.AuthPass = "hashed"
+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")
+
+ paths := []string{
+ "/install-docker-agent.sh",
+ "/install-container-agent.sh",
+ "/download/pulse-docker-agent",
+ "/install-host-agent.sh",
+ "/install-host-agent.ps1",
+ "/uninstall-host-agent.sh",
+ "/uninstall-host-agent.ps1",
+ "/download/pulse-host-agent",
+ "/install.sh",
+ "/install.ps1",
+ "/download/pulse-agent",
+ }
+
+ for idx, path := range paths {
+ ip := "203.0.113." + strconv.Itoa(70+idx)
+ ResetRateLimitForIP(ip)
+ req := httptest.NewRequest(http.MethodPost, path, nil)
+ req.RemoteAddr = ip + ":1234"
+ rec := httptest.NewRecorder()
+ router.Handler().ServeHTTP(rec, req)
+ if rec.Code != http.StatusMethodNotAllowed {
+ t.Fatalf("expected 405 for public download endpoint %s, got %d", path, rec.Code)
+ }
+ }
+}
+
func TestOIDCLoginBypassesAuth(t *testing.T) {
cfg := newTestConfigWithTokens(t)
cfg.AuthUser = "admin"