create_ticket_api.php: no rate limiting on external Bearer-key endpoint #27

Closed
opened 2026-08-31 21:29:38 -04:00 by jared · 1 comment
Owner

Severity: High

create_ticket_api.php is missing RateLimitMiddleware::apply('api'), which every other endpoint (including the other two Bearer endpoints ticket_status_api.php and ticket_comment_api.php) calls at the top of the file.

README.md:104 claims the whole Bearer API is "rate-limited" — this endpoint contradicts that.

Impact: Anyone with a leaked/guessed API key (or even a pre-auth flood — ApiKeyAuth::authenticate() still does a SHA-256 hash + DB SELECT per request before rejecting) can hammer ticket creation unthrottled. Each insert also fires a Matrix webhook via NotificationHelper::sendTicketNotification, so this can spam the Matrix room and/or run the DB/webhook target into the ground.

Fix: Add require_once .../RateLimitMiddleware.php; RateLimitMiddleware::apply('api'); near the top of create_ticket_api.php, before the DB connection is opened, matching the other Bearer endpoints.

**Severity:** High `create_ticket_api.php` is missing `RateLimitMiddleware::apply('api')`, which every other endpoint (including the other two Bearer endpoints `ticket_status_api.php` and `ticket_comment_api.php`) calls at the top of the file. README.md:104 claims the whole Bearer API is "rate-limited" — this endpoint contradicts that. **Impact:** Anyone with a leaked/guessed API key (or even a pre-auth flood — `ApiKeyAuth::authenticate()` still does a SHA-256 hash + DB SELECT per request before rejecting) can hammer ticket creation unthrottled. Each insert also fires a Matrix webhook via `NotificationHelper::sendTicketNotification`, so this can spam the Matrix room and/or run the DB/webhook target into the ground. **Fix:** Add `require_once .../RateLimitMiddleware.php; RateLimitMiddleware::apply('api');` near the top of `create_ticket_api.php`, before the DB connection is opened, matching the other Bearer endpoints.
jared added the apipriority/highrate-limitingsecurity labels 2026-09-08 10:15:43 -04:00
Author
Owner

Fixed and verified against real MariaDB (schema/migration/access-control cases). Merged to main in commit 3664719.

Fixed and verified against real MariaDB (schema/migration/access-control cases). Merged to main in commit 3664719.
jared closed this issue 2026-09-08 21:33:42 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/tinker_tickets#27