|
3 | 3 | // This product includes software developed at Datadog (https://www.datadoghq.com/).
|
4 | 4 | // Copyright 2022 Datadog, Inc.
|
5 | 5 |
|
6 |
| -// Package events provides the types and interfaces for the appsec event system. |
7 |
| -// User-facing events can be returned by the appsec package to signal that a request was blocked. |
8 |
| -// Handling these events differently than other errors is crucial to not leak information to an attacker. |
| 6 | +// Package events provides security event types that appsec can return in function calls it monitors when blocking them. |
| 7 | +// It allows finer-grained integrations of appsec into your Go errors' management logic. |
9 | 8 | package events
|
10 | 9 |
|
11 | 10 | var _ error = (*BlockingSecurityEvent)(nil)
|
12 | 11 |
|
13 |
| -// BlockingSecurityEvent is an event that signals that a request was blocked by the WAF. |
14 |
| -// It should be handled differently than other errors to avoid leaking information to an attacker. |
15 |
| -// If this error was returned by native types wrapped by dd-trace-go, it means that a 403 response will be written |
16 |
| -// by appsec middleware (or any other status code defined in DataDog's UI). Therefore, the user should not write a |
17 |
| -// response in the handler. |
| 12 | +// BlockingSecurityEvent is the error type returned by function calls blocked by appsec. |
| 13 | +// Even though appsec takes care of responding automatically to the blocked requests, it |
| 14 | +// is your duty to abort the request handlers that are calling functions blocked by appsec. |
| 15 | +// For instance, if a gRPC handler performs a SQL query blocked by appsec, the SQL query |
| 16 | +// function call gets blocked and aborted by returning an error of type SecurityBlockingEvent. |
| 17 | +// This allows you to safely abort your request handlers, and to be able to leverage errors.As if |
| 18 | +// necessary in your Go error management logic to be able to tell if the error is a blocking security |
| 19 | +// event or not (eg. to avoid retrying an HTTP client request). |
18 | 20 | type BlockingSecurityEvent struct{}
|
19 | 21 |
|
20 | 22 | func (*BlockingSecurityEvent) Error() string {
|
|
0 commit comments