From 80919dae21a4feb913293741a755adc372dc6ee9 Mon Sep 17 00:00:00 2001 From: Winston Howes Date: Fri, 24 Apr 2026 18:18:35 -0700 Subject: [PATCH] clear denylist when deleting integration --- app/integration.go | 4 ++++ app/integration_test.go | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/app/integration.go b/app/integration.go index ce8f35d..d3c6234 100644 --- a/app/integration.go +++ b/app/integration.go @@ -624,4 +624,8 @@ func DeleteIntegration(name string) { allowlists.Lock() delete(allowlists.m, n) allowlists.Unlock() + + denylists.Lock() + delete(denylists.m, n) + denylists.Unlock() } diff --git a/app/integration_test.go b/app/integration_test.go index 078e887..58b7401 100644 --- a/app/integration_test.go +++ b/app/integration_test.go @@ -650,6 +650,33 @@ func TestDeleteIntegrationRemovesAllowlist(t *testing.T) { } } +func TestDeleteIntegrationRemovesDenylist(t *testing.T) { + denylists.Lock() + denylists.m = make(map[string]map[string][]CallRule) + denylists.Unlock() + + name := "deldl" + i := &Integration{Name: name, Destination: "http://example.com"} + if err := AddIntegration(i); err != nil { + t.Fatalf("add: %v", err) + } + if err := SetDenylist(name, []DenylistCaller{{ + ID: "*", + Rules: []CallRule{{ + Path: "/blocked", + Methods: map[string]RequestConstraint{"GET": {}}, + }}, + }}); err != nil { + t.Fatalf("set denylist: %v", err) + } + + DeleteIntegration(name) + + if got := GetDenylist(name); len(got) != 0 { + t.Fatalf("denylist not removed: %v", got) + } +} + func TestIntegrationRateLimitWindow(t *testing.T) { i := &Integration{ Name: "window",