Skip to content

Conversation

@ThyMinimalDev
Copy link
Contributor

@ThyMinimalDev ThyMinimalDev commented Feb 2, 2026

What does this PR do?

Adds multiple layers of protection to the booking-guests API endpoint to prevent abuse by scammers who could use it to send spam emails to hundreds of guests through our system.

Changes:

  • Limits guests per request to 10 (input validation via ArrayMaxSize)
  • Limits total guests per booking to 30 (service-level validation)
  • Adds aggressive rate limiting: 5 requests per minute with 60-second block duration
  • Updates API documentation (openapi.json) to reflect new limits and constraints

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. Updated openapi.json with new limits.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Test per-request limit: Try to add more than 10 guests in a single request - should return validation error with message "Cannot add more than 10 guests at a time"
  2. Test total guest limit: Add guests to a booking until it has 30 attendees, then try to add more - should return BadRequestException with helpful message showing remaining slots
  3. Test rate limiting: Make more than 5 requests within 60 seconds - should return throttle error

Checklist

  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings
  • My PR is appropriately sized

Human Review Checklist

  • Verify the hardcoded limits (10 per request, 30 total, 5 req/min) are appropriate values for preventing abuse
  • Confirm that counting booking.attendees.length (which includes all attendees, not just guests) is the intended behavior for the 30-guest limit
  • Consider if unit tests should be added for the new validation logic
  • Note: openapi.json was manually updated - verify it stays in sync if regenerated

Updates since last revision

  • Removed minItems: 1 from openapi.json to avoid breaking change CI failure (the validation already existed in code via @ArrayMinSize(1), but documenting it in openapi.json was flagged as a breaking API change)

Link to Devin run: https://app.devin.ai/sessions/f4f2e369887d41f7b2261353a29e052c
Requested by: @ThyMinimalDev

- Add ArrayMaxSize(10) validation to limit guests per request to 10
- Add aggressive rate limiting (5 requests/minute) via @Throttle decorator
- Add total guest limit check (max 30 guests per booking) to prevent abuse
- Update API documentation to reflect new limits

This prevents scammers from using the endpoint to send spam emails
to hundreds of guests through our system.

Co-Authored-By: morgan@cal.com <morgan@cal.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

keithwillcode
keithwillcode previously approved these changes Feb 2, 2026
@ThyMinimalDev ThyMinimalDev marked this pull request as ready for review February 2, 2026 09:15
@ThyMinimalDev ThyMinimalDev requested review from a team as code owners February 2, 2026 09:15
@graphite-app graphite-app bot added foundation ready-for-e2e core area: core, team members only labels Feb 2, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Co-Authored-By: morgan@cal.com <morgan@cal.com>
@ThyMinimalDev ThyMinimalDev force-pushed the devin/1770022907-limit-booking-guests branch from 1ce1cb1 to 931e5d4 Compare February 2, 2026 09:48
@ThyMinimalDev ThyMinimalDev merged commit d29c8a4 into main Feb 2, 2026
43 of 46 checks passed
@ThyMinimalDev ThyMinimalDev deleted the devin/1770022907-limit-booking-guests branch February 2, 2026 09:49
ThyMinimalDev added a commit that referenced this pull request Feb 2, 2026
…27494)

* fix: add guest limits and rate limiting to booking-guests endpoint

- Add ArrayMaxSize(10) validation to limit guests per request to 10
- Add aggressive rate limiting (5 requests/minute) via @Throttle decorator
- Add total guest limit check (max 30 guests per booking) to prevent abuse
- Update API documentation to reflect new limits

This prevents scammers from using the endpoint to send spam emails
to hundreds of guests through our system.

Co-Authored-By: morgan@cal.com <morgan@cal.com>

* docs: update openapi.json with guest limits and rate limiting info

Co-Authored-By: morgan@cal.com <morgan@cal.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

E2E results are ready!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants