-
Couldn't load subscription status.
- Fork 484
feat(appsec/proxy): enable body processing by default (except GCP SE) #4069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
ddaf5a2
90cada9
e873ce2
fb33a1e
f61a2f2
48767a0
6ac40d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ import ( | |
| "context" | ||
| "errors" | ||
| "io" | ||
| "sync/atomic" | ||
|
|
||
| "github.com/DataDog/dd-trace-go/v2/instrumentation" | ||
| "github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/proxy" | ||
|
|
@@ -41,20 +40,32 @@ type AppsecEnvoyConfig struct { | |
| Integration Integration | ||
| BlockingUnavailable bool | ||
| Context context.Context | ||
| BodyParsingSizeLimit int | ||
| BodyParsingSizeLimit *int | ||
| } | ||
|
|
||
| // appsecEnvoyExternalProcessorServer is a server that implements the Envoy ExternalProcessorServer interface. | ||
| type appsecEnvoyExternalProcessorServer struct { | ||
| envoyextproc.ExternalProcessorServer | ||
| config AppsecEnvoyConfig | ||
| requestCounter atomic.Uint32 | ||
| messageProcessor proxy.Processor | ||
| } | ||
|
|
||
| // AppsecEnvoyExternalProcessorServer creates a new external processor server with AAP enabled | ||
| func AppsecEnvoyExternalProcessorServer(userImplementation envoyextproc.ExternalProcessorServer, config AppsecEnvoyConfig) envoyextproc.ExternalProcessorServer { | ||
| processor := &appsecEnvoyExternalProcessorServer{ | ||
| switch config.Integration { | ||
| case GCPServiceExtensionIntegration: | ||
| case EnvoyIntegration, IstioIntegration, EnvoyGatewayIntegration: | ||
| // Set default body parsing size limit if not specified for non-default integrations | ||
| if config.BodyParsingSizeLimit == nil { | ||
| defaultBody := proxy.DefaultBodyParsingSizeLimit | ||
| config.BodyParsingSizeLimit = &defaultBody | ||
| } | ||
|
||
| default: | ||
| instr.Logger().Error("external_processing: invalid proxy integration type %d. Defaulting to GCPServiceExtensionIntegration", config.Integration) | ||
| config.Integration = GCPServiceExtensionIntegration | ||
| } | ||
|
|
||
| return &appsecEnvoyExternalProcessorServer{ | ||
| ExternalProcessorServer: userImplementation, | ||
| config: config, | ||
| messageProcessor: proxy.NewProcessor(proxy.ProcessorConfig{ | ||
|
|
@@ -66,15 +77,6 @@ func AppsecEnvoyExternalProcessorServer(userImplementation envoyextproc.External | |
| BlockMessageFunc: blockActionFunc, | ||
| }, instr), | ||
| } | ||
|
|
||
| switch config.Integration { | ||
| case GCPServiceExtensionIntegration, EnvoyIntegration, IstioIntegration, EnvoyGatewayIntegration: | ||
| default: | ||
| instr.Logger().Error("external_processing: invalid proxy integration type %d. Defaulting to GCPServiceExtensionIntegration", config.Integration) | ||
| config.Integration = GCPServiceExtensionIntegration | ||
| } | ||
|
|
||
| return processor | ||
| } | ||
|
|
||
| type processServerKeyType struct{} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.