Skip to content

Bug: Server Crash in Views Analytics Endpoint due to Unvalidated Pagination Parameters #217

@anshul23102

Description

@anshul23102

Description

In the /api/analytics/views endpoint, the page query parameter is parsed into an integer and used to calculate skip for pagination. However, the value is not validated. If a client sends a negative number or a non-numeric string (which parses to NaN), the calculated skip value will be negative or NaN. Passing these values to the Prisma query causes a validation error and crashes the request.

Source Code Location

File: apps/backend/src/routes/analytics.ts

Proposed Fix

Sanitize and validate the page parameter to ensure it is a positive integer before performing database queries.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions