From 673ebfa854e26e8020f04ece7c902fd6d8105934 Mon Sep 17 00:00:00 2001 From: Eliott Bouhana Date: Mon, 17 Jun 2024 16:13:40 +0200 Subject: [PATCH] appsec: fix IsSecurityError Signed-off-by: Eliott Bouhana --- appsec/events/block.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appsec/events/block.go b/appsec/events/block.go index 8db51b8268..b405bdd97d 100644 --- a/appsec/events/block.go +++ b/appsec/events/block.go @@ -11,8 +11,6 @@ import "errors" var _ error = (*BlockingSecurityEvent)(nil) -var securityError = &BlockingSecurityEvent{} - // BlockingSecurityEvent is the error type returned by function calls blocked by appsec. // Even though appsec takes care of responding automatically to the blocked requests, it // is your duty to abort the request handlers that are calling functions blocked by appsec. @@ -29,5 +27,6 @@ func (*BlockingSecurityEvent) Error() string { // IsSecurityError returns true if the error is a security event. func IsSecurityError(err error) bool { - return errors.Is(err, securityError) + var secErr *BlockingSecurityEvent + return errors.As(err, &secErr) }