feat(web): enforce response-size limits on public analytics endpoints (#417) - #427
Conversation
…enliven17#417) - Implement shared parseAnalyticsLimit validation helper with positive integer checks and upper-bound enforcement - Apply route-specific limit validation and database query bounds on exposure, alerts, financial-summary, financial-projection, patrons, dividends, revenue, proposals, and ecosystem-intelligence - Sanitize error envelopes to prevent internal database and implementation leakage - Add comprehensive test coverage for default, maximum, over-limit, and malformed parameter handling
|
@Emmycivity 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! 🚀 |
|
@Emmycivity is attempting to deploy a commit to the Cankat's projects Team on Vercel. A member of the Team first needs to authorize it. |
enliven17
left a comment
There was a problem hiding this comment.
The focused analytics-limit tests pass (62/62), but the PR has a significant scope problem: it adds unrelated webhook subscriptions, webhook deliveries, transactional outbox, background jobs, relations, and internal-auth schema changes while implementing analytics response limits. Those additions introduce broad migration/type surface area and should not be bundled into this security change. Please remove the unrelated schema/routes or split them into separate PRs, then rerun the full relevant type and test checks. Keep the analytics PR limited to bounded response behavior and its tests.
|
Closing this PR because the analytics-limit change bundles unrelated webhook, outbox, jobs, relations, and auth schema changes. Please split the scope and resubmit the analytics protection with only the necessary production code and tests. |
|
Scope split as requested: this PR has been resubmitted as #484 with only the analytics response-size-limit production code and its tests. The webhook subscriptions/deliveries, transactional outbox, background jobs, relations, and internal-auth schema changes were removed from the branch. Verified on the resubmission:
|
Overview
Enforces explicit, bounded response-size limits on public analytics endpoints and collection detail routes, introduces a shared limit validation helper, ensures database queries never allocate unbounded collections, and guarantees error responses do not leak database or internal details.
Related Issue
Closes #417
Changes
Analytics Limits & Public Endpoints
web/src/lib/analytics-limits.tsparseAnalyticsLimithelper to validate positive integer limits and enforce route-specific maximums (returning HTTP 400 validation error on over-limit or malformed values).web/src/app/api/ecosystem-intelligence/route.tsweb/src/app/api/talos/[id]/exposure/route.tsweb/src/app/api/talos/[id]/exposure/alerts/route.tsweb/src/app/api/talos/[id]/financial-summary/route.tsweb/src/app/api/talos/[id]/financial-projection/route.tsweb/src/app/api/talos/[id]/patrons/route.tsweb/src/app/api/talos/[id]/dividends/route.tsweb/src/app/api/talos/[id]/revenue/route.tsweb/src/app/api/proposals/route.tsweb/src/app/api/dashboard/route.tsTests
web/tests/analytics-limits.unit.test.tsweb/tests/analytics-route-limits.unit.test.tsweb/src/app/api/talos/[id]/exposure/__tests__/route.test.tsweb/src/app/api/talos/[id]/exposure/alerts/__tests__/route.test.tsweb/src/app/api/talos/[id]/financial-summary/__tests__/route.test.tsweb/tests/ecosystem-intelligence.test.tsVerification Results