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.

test: license gate audit webhook endpoint

rcourtman0a26ef622a63
diff --git a/internal/api/security_regression_test.go b/internal/api/security_regression_test.go
index 54ded0bf43..13be9e28e8 100644
--- a/internal/api/security_regression_test.go
+++ b/internal/api/security_regression_test.go
@@ -1697,6 +1697,21 @@ func TestRBACEndpointsRequireLicenseFeature(t *testing.T) {
}
}
+func TestAuditWebhookRequiresLicenseFeature(t *testing.T) {
+ rawToken := "audit-webhook-license-token-123.12345678"
+ record := newTokenRecord(t, rawToken, []string{config.ScopeSettingsRead}, nil)
+ cfg := newTestConfigWithTokens(t, record)
+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")
+
+ req := httptest.NewRequest(http.MethodGet, "/api/admin/webhooks/audit", nil)
+ req.Header.Set("X-API-Token", rawToken)
+ rec := httptest.NewRecorder()
+ router.Handler().ServeHTTP(rec, req)
+ if rec.Code != http.StatusPaymentRequired {
+ t.Fatalf("expected 402 for missing audit logging license, got %d", rec.Code)
+ }
+}
+
func TestAgentProfilesRequireLicenseFeature(t *testing.T) {
rawToken := "profiles-license-token-123.12345678"
record := newTokenRecord(t, rawToken, []string{config.ScopeSettingsWrite}, nil)