Feat: dedicated rate limits account linking privacy - #179
Merged
Kaylahray merged 4 commits intoApr 29, 2026
Merged
Conversation
Main repo update
…ncellation semantics
Kaylahray
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR resolves three related issues against the data-export and user-preferences API surface.
#153 — Dedicated rate limits for account-linking and privacy routes
rateLimitStorefromsrc/middleware/rateLimiter.tsand addsaccountLinking(10/hr) andprivacyUpdates(20/hr) configsaccountLinkingRateLimiterandprivacyRateLimiterpre-built middleware, scoped per authenticated useraccountLinkingRateLimiteronto write routes:POST /account-links,POST /account-links/check-availability,POST /account-links/verify,DELETE /account-links/:providerprivacyRateLimiteronto allPOST /privacy/*routes — GET routes unaffectedvitest.config.tssetupFilesentry and a globalafterEach(() => rateLimitStore.clear())intestSetup.tsso feature limiters don't bleed across test casessrc/controllers/__tests__/rate-limits.test.tswith happy-path header checks and exhaustion (429) tests for both limiters#154 — Align export request collection responses with
meta.paginationcontractgetExportRequeststo returnmeta: { pagination: ... }instead of top-levelpagination:DataExportRequestCollection.data()to forwardpaginationso the class works correctly through theJsonResourcepipelinegetExportRequeststests verifying themeta.paginationshape and empty-state zeroed pagination#155 — Separate cancelled export requests from expired download links
cancelledtoDataExportRequestStatusenum inprisma/schema.prisma20260428000000_add_cancelled_export_status(ALTER TYPE ... ADD VALUE 'cancelled')cancelExportnow writesstatus: 'cancelled'instead of'expired'cancelExportguard rejects already-cancelled requests (400) alongsidereadyandexpirednotIn: ['expired', 'cancelled']so a cancelled export does not block a new requestexpiredas TTL-based andcancelledas user-initiateddata-export-http.test.ts: fixes staleexpiredassertion, fixespagination→meta.pagination, adds idempotent-cancel and post-cancel re-request testsTest plan
POST /account-links— 11th request in window returns 429 withRetry-After;GET /account-linksunaffectedPOST /privacy— 21st request in window returns 429;GET /privacyunaffectedGET /api/data-export/requestsreturnsmeta.paginationwith correct shape; no top-levelpaginationkeystatus: 'cancelled', not'expired'expiredstatus is only set by TTL-based download-link expiry, not by user actionCloses #153
Closes #154
Closes #155