Skip to content

Fix/sendgrid retry and body size limit#1027

Open
Olisachukwuma1 wants to merge 2 commits into
solutions-plug:mainfrom
Olisachukwuma1:fix/sendgrid-retry-and-body-size-limit
Open

Fix/sendgrid retry and body size limit#1027
Olisachukwuma1 wants to merge 2 commits into
solutions-plug:mainfrom
Olisachukwuma1:fix/sendgrid-retry-and-body-size-limit

Conversation

@Olisachukwuma1

Copy link
Copy Markdown
Contributor

closes #922
closes #923

Description

Type of Change

  • Bug fix
  • New feature
  • Refactor / code cleanup
  • Documentation update
  • CI / tooling change
  • Breaking change

Testing Done

Checklist

  • Tests pass locally
  • Documentation updated (if applicable)
  • No breaking changes, or breaking changes are documented above

Related Issues

Closes #

…s counter

- Add sendgrid_retries_total{reason} counter to Metrics
- Retry on 429 and 5xx responses (max 3 attempts)
- Exponential backoff with jitter (2^attempt * 100ms + rand[0,100)ms)
- Respect Retry-After header on 429 responses
- Add wiremock to dev-dependencies for HTTP mock testing
- Add test: two 429s followed by 202 verifies email sent and counter=2

Closes #reliability #email
…ed body)

- Add DEFAULT_REQUEST_BODY_MAX_BYTES = 1 MiB constant
- Add request_size_validation_middleware to validation.rs
  - Fast path: reject on Content-Length header > limit
  - Slow path: buffer chunked body via axum::body::to_bytes with cap
  - Returns 413 Payload Too Large with JSON error body
- Add content_type_validation_middleware (415 for non-JSON POST/PUT/PATCH)
- Add request_validation_middleware (400 for SQLi/path-traversal patterns)
- Add parse_request_body_max_bytes() for env-var override
- Add two_mb_body_returns_413 integration test

Closes #security #reliability #api
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Olisachukwuma1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No retry logic on transient SendGrid API failures No request body size limit documented or enforced in API handlers

1 participant