Skip to content

feat: API rate limit - #348

Merged
Nadil-K merged 17 commits into
mainfrom
201-rate-limit-the-subscribe-endpoint
Oct 26, 2026
Merged

Nadil-K merged 17 commits into
mainfrom
201-rate-limit-the-subscribe-endpoint

Conversation

@Nolab0

@Nolab0 Nolab0 commented Nov 20, 2025 •

Copy link
Copy Markdown
Member

close #201

Important: we must update the webhook URL in hyvor Relay in Production

@Nolab0
Nolab0 requested review from Nadil-K and supun-io November 20, 2025 10:35
@supun-io
supun-io force-pushed the 201-rate-limit-the-subscribe-endpoint branch from 3c69466 to 25a3932 Compare November 20, 2025 14:18

@supun-io supun-io left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • add public API rate limit per IP (30 per minute per IP)
  • move RelayWebhook out of public API: /api/machine
    • add this to routes
    • Move RelayWebhookController
    • RelayWebhookTest
  • check Public API rate limits in a separate test

@supun-io supun-io changed the title 201 rate limit the subscribe endpoint API rate limiting Mar 4, 2026
@supun-io supun-io changed the title API rate limiting feat: API rate limit May 5, 2026

@Nadil-K Nadil-K left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • Resolve conflicts. (Might need to update for AbstractAuthorizationListner from internal)
  • Show a message like "You have recently requested a subscription confirm link: Please try again in x seconds" (x counting down in real time) at the subscribe form

Comment thread backend/src/Api/RateLimit/RateLimit.php Resolved
Nolab0 and others added 9 commits October 23, 2026 14:44
- Port console rate limiting to ConsoleAuthResults (cloud API auth from
  #461): sessions are limited per user, product API keys and cloud tokens
  per auth source. Skip auth-bypassed paths like /api/console/init.
- Keep main's test issue limit (10/hour per newsletter) as a stricter
  limit on top of the general one; its headers win on that endpoint.
- Bring main's test issue rate limit tests along.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Nolab0
Nolab0 force-pushed the 201-rate-limit-the-subscribe-endpoint branch from 5ff57ce to 2ecc62d Compare October 23, 2026 12:50
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Nadil-K Nadil-K left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • Use IpService::resolveIp() in FormController::subscribe() (it still saves the CF IP)

$this->assertResponseHeaderSame('X-RateLimit-Remaining', '99');
}

public function test_subscribe_endpoint_applies_per_minute_email_rate_limit(): void

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • move these public API tests to tests/Api/Public/RateLimitTest.php

@Nadil-K
Nadil-K merged commit 09365b1 into main Oct 26, 2026
7 checks passed
@Nadil-K
Nadil-K deleted the 201-rate-limit-the-subscribe-endpoint branch October 26, 2026 10:50
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.

Rate limit the /subscribe endpoint

3 participants