Description
DebugProbe currently allows MaxBodyCaptureSizeKb to be configured with negative values.
Negative values can break request and response body capture calculations, leading to unexpected behavior during body truncation and size validation.
Current Behavior
MaxBodyCaptureSizeKb can currently be configured with invalid values such as:
builder.Services.AddDebugProbe(options =>
{
options.MaxBodyCaptureSizeKb = -1;
});
This may cause incorrect body size calculations and unexpected capture behavior.
Expected Behavior
DebugProbe should validate MaxBodyCaptureSizeKb and reject invalid values during application startup.
Suggested Fix
Validate MaxBodyCaptureSizeKb during options configuration or initialization.
Recommended validation:
MaxBodyCaptureSizeKb >= 0
A value of:
0 disables body capture
- Positive values enable body capture up to the configured limit
If an invalid value is provided, throw a clear configuration exception explaining the allowed range.
Result
After this change:
- Invalid configuration is detected early.
- Body capture calculations remain predictable.
- Unexpected truncation or capture behavior is prevented.
- Users receive clear feedback when configuration values are invalid.
Description
DebugProbe currently allows
MaxBodyCaptureSizeKbto be configured with negative values.Negative values can break request and response body capture calculations, leading to unexpected behavior during body truncation and size validation.
Current Behavior
MaxBodyCaptureSizeKbcan currently be configured with invalid values such as:This may cause incorrect body size calculations and unexpected capture behavior.
Expected Behavior
DebugProbe should validate
MaxBodyCaptureSizeKband reject invalid values during application startup.Suggested Fix
Validate
MaxBodyCaptureSizeKbduring options configuration or initialization.Recommended validation:
A value of:
0disables body captureIf an invalid value is provided, throw a clear configuration exception explaining the allowed range.
Result
After this change: