Skip to content

id(directory): bound aggregate pending email-code state and issuance cost #5749

Open

Description

@dezren39

Problem

Pending email verification state has expiry but no aggregate size bound. In pkgs/id/src/directory_auth.rs:149-161 and 167-188, issue_code sweeps expired entries and then inserts the new address; the map has no hard capacity, and each issuance scans it. Authenticated AddEmail accepts caller-supplied addresses (pkgs/id/src/directory_view.rs:1238-1257). Repeated requests for unique addresses can grow memory without bound and make each later issuance more expensive.

Closed #1732 addressed retention of expired codes but does not bound many unexpired entries.

Required behavior

Introduce an explicit global and/or per-principal cap for pending email-code state. Reject or replace excess entries deterministically, preserve normal resend and expiry semantics, and make sure one principal cannot starve unrelated users. Keep verification and one-time-use behavior unchanged.

Acceptance criteria

  • Tests fill the pending-code capacity and verify deterministic rejection or eviction without exceeding the bound.
  • If per-principal isolation is the chosen policy, a test proves one principal cannot consume every slot.
  • Expired entries are still reclaimed, and valid codes still verify exactly once.
  • Issuance cost stays bounded as the number of distinct pending addresses grows.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 5, 2026
  2. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor
  3. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 5, 2026
  4. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor

    agent-note:v1
    task: 10161
    lane: code-j
    state: handed_off
    execution_lane: opencode
    note: Claimed by lane code-j (attempt 3/6, repeat handoff); issue #5749 verified OPEN with no hard-stop labels via developing.today app token (gh user token rate-limited). Handed off to opencode claimant to launch the bound session; parking 1800s pending claimant launch.

  5. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 5, 2026
  6. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 5, 2026
  7. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  8. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)status/parkedDeliberately paused with a recorded resume conditiontask/triageQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle state

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions