-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into julio.guerra/fix-grpc…
…-blocking
- Loading branch information
Showing
67 changed files
with
1,930 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2022 Datadog, Inc. | ||
|
||
// Package events provides security event types that appsec can return in function calls it monitors when blocking them. | ||
// It allows finer-grained integrations of appsec into your Go errors' management logic. | ||
package events | ||
|
||
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. | ||
// For instance, if a gRPC handler performs a SQL query blocked by appsec, the SQL query | ||
// function call gets blocked and aborted by returning an error of type SecurityBlockingEvent. | ||
// This allows you to safely abort your request handlers, and to be able to leverage errors.As if | ||
// necessary in your Go error management logic to be able to tell if the error is a blocking security | ||
// event or not (eg. to avoid retrying an HTTP client request). | ||
type BlockingSecurityEvent struct{} | ||
|
||
func (*BlockingSecurityEvent) Error() string { | ||
return "request blocked by WAF" | ||
} | ||
|
||
// IsSecurityError returns true if the error is a security event. | ||
func IsSecurityError(err error) bool { | ||
return errors.Is(err, securityError) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ COPYRIGHT_HEADER="// Unless explicitly stated otherwise all files in this reposi | |
// Copyright ${YEAR} Datadog, Inc. | ||
" | ||
|
||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0 | ||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.33.0 | ||
go install google.golang.org/grpc/cmd/[email protected] | ||
|
||
protoc fixtures_test.proto \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.