Skip to content

[Bug] No limit on future streak freeze creation users can stockpile unlimited freezes #1476

Closed

Description

@Midoriya-w

This issue is raised as part of GSSoC'26. Kindly consider assigning it to me.

Summary

In src/app/api/streak/freeze/route.ts, the POST handler only checks
for a duplicate freeze on today's date specifically:

.eq("freeze_date", today)

There is no check for how many total pending freezes a user already
holds. A user can call POST /api/streak/freeze with future dates
repeatedly and stockpile an unlimited number of unused freezes,
completely bypassing the intended one-freeze limit.

Steps to Reproduce

  1. Call POST /api/streak/freeze for today
  2. Modify the request to use tomorrow's date
  3. Repeat for future dates
  4. Observe unlimited freezes accumulate with no restriction

Expected Behavior

Users should be limited to a maximum number of unused freezes
at any time (e.g. 1 or a configurable max).

Actual Behavior

No upper limit exists. Users can stockpile unlimited pending
freezes by targeting future dates.

Fix

Add a count check before allowing new freeze creation:

const { count } = await supabaseAdmin
.from("streak_freezes")
.select("*", { count: "exact", head: true })
.eq("user_id", user.id)
.gte("freeze_date", today);

const MAX_PENDING_FREEZES = 1;
if (count && count >= MAX_PENDING_FREEZES) {
return Response.json(
{ error: "You already have a pending freeze." },
{ status: 409 }
);
}

Activity

  1. added
    bug
    needs-triage
    on May 29, 2026
  2. Midoriya-w commented on May 29, 2026

    @Midoriya-w
    ContributorAuthor

    Hey @Priyanshu-byte-coder I discovered this bug while auditing the codebase and would love to fix it under GSSoC 2026. Can I get assigned?

  3. Midoriya-w commented on May 29, 2026

    @Midoriya-w
    ContributorAuthor

    Hey @Priyanshu-byte-coder,

    I've implemented the fix and opened a PR for review: #1540

    Changes made:

    • Added a pending freeze count check before creating a new freeze
    • Enforced a maximum limit of 1 pending freeze per user
    • Return HTTP 409 when the limit is exceeded
    • Prevent users from stockpiling unused freezes

    Ready for review. Thanks.

  4. added
    type:bug
    level:intermediate
    and removed
    needs-triage
    on Jun 2, 2026
  5. rudrakshtank commented on Jun 19, 2026

    @rudrakshtank
    Contributor

    Hi mentor I am a Gssoc contributor please can you assign me this issue so I can work on it.

  6. github-actions commented on Jun 19, 2026

    @github-actions

    @rudrakshtank This issue is already taken by @Midoriya-w. Check other open issues!

  7. Priyanshu-byte-coder commented on Jul 29, 2026

    @Priyanshu-byte-coder
    Owner

    Closing — already implemented on main. The freeze endpoint guards against stockpiling — src/app/api/streak/freeze/route.ts counts existing unused freezes and rejects extras (it's also timezone-correct now).

    Part of a tracker cleanup pass. Comment if you think a specific part is still missing and I'll reopen.

  8. github-actions commented on Jul 29, 2026

    @github-actions

    ✅ Closed as completed!

    If DevTrack has been useful, a ⭐ star on the repo helps the project grow and reach more developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buglevel:intermediatetype:bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions