Skip to content

Conversation

@jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Dec 15, 2025

Related to PR #3060 where I forgot to set the audit max size, let's default to a sane value rather than the Go default value for the audit max size.

When max_data_size is not specified in the audit config, Go's zero value (0) was used directly. This caused the size check len(body) <= 0 to always fail for non-empty bodies, preventing data capture.

Changes:

  • Validate() now applies the default value (1024) when MaxDataSize is 0
  • CreateMiddleware() now calls Validate() to ensure defaults are applied
  • Added test coverage for default application and value preservation

When max_data_size is not specified in the audit config, Go's zero
value (0) was used directly. This caused the size check len(body) <= 0
to always fail for non-empty bodies, preventing data capture.

Changes:
- Validate() now applies the default value (1024) when MaxDataSize is 0
- CreateMiddleware() now calls Validate() to ensure defaults are applied
- Added test coverage for default application and value preservation
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Dec 15, 2025
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.51%. Comparing base (589ecb5) to head (fea0e09).

Files with missing lines Patch % Lines
pkg/audit/middleware.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3061      +/-   ##
==========================================
- Coverage   56.51%   56.51%   -0.01%     
==========================================
  Files         334      334              
  Lines       33170    33174       +4     
==========================================
+ Hits        18747    18749       +2     
- Misses      12839    12840       +1     
- Partials     1584     1585       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants