Skip to content

Commit

Permalink
appsec: fix IsSecurityError
Browse files Browse the repository at this point in the history
Signed-off-by: Eliott Bouhana <[email protected]>
  • Loading branch information
eliottness committed Jun 17, 2024
1 parent 79237af commit 673ebfa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions appsec/events/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
}

0 comments on commit 673ebfa

Please sign in to comment.