Skip to content

Cap huge notification offsets before querying Supabase #342

@Jorel97

Description

@Jorel97

Bug

GET /api/notifications clamps limit, but only clamps offset to a minimum of 0. Very large offset values are passed directly into the Supabase .range() call.

Impact

A request such as ?offset=999999999&limit=25 can ask the database for an extreme range start. Other recently hardened pagination endpoints cap offsets/page values before building ranges, so notifications should do the same.

Expected

Malformed and negative offsets should default/clamp to 0, and extremely large offsets should be capped before .range() is called.

Metadata

Metadata

Assignees

No one assigned

    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