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.

Give invalid-bearer auth controls their own session stores

pulse-triage[bot]7cbeb99c7d91
diff --git a/internal/api/auth_additional_coverage_test.go b/internal/api/auth_additional_coverage_test.go
index 53d6c2a337..289457466f 100644
--- a/internal/api/auth_additional_coverage_test.go
+++ b/internal/api/auth_additional_coverage_test.go
@@ -171,6 +171,9 @@ func TestCheckAuth_AcceptsBearerToken(t *testing.T) {
}
func TestCheckAuth_InvalidBearerDoesNotFallBackToSession(t *testing.T) {
+ InitSessionStore(t.TempDir())
+ t.Cleanup(GetSessionStore().Shutdown)
+
record, err := config.NewAPITokenRecord("token-valid-123.12345678", "api", []string{config.ScopeMonitoringRead})
if err != nil {
t.Fatalf("NewAPITokenRecord: %v", err)
diff --git a/internal/api/auth_context_middleware_test.go b/internal/api/auth_context_middleware_test.go
index f14e74707d..d13dd7fb2e 100644
--- a/internal/api/auth_context_middleware_test.go
+++ b/internal/api/auth_context_middleware_test.go
@@ -139,6 +139,9 @@ func TestExtractAndStoreAuthContext_SessionCookie(t *testing.T) {
}
func TestExtractAndStoreAuthContext_InvalidBearerDoesNotFallBackToSession(t *testing.T) {
+ InitSessionStore(t.TempDir())
+ t.Cleanup(GetSessionStore().Shutdown)
+
record, err := config.NewAPITokenRecord("ctx-valid-token-123.12345678", "ctx-token", []string{config.ScopeMonitoringRead})
if err != nil {
t.Fatalf("new token record: %v", err)