Commit Graph
4 Commits
Author SHA1 Message Date
zeekay da277ae96a fix: gofmt -s across repo (CI format check) 2026-06-02 11:39:20 -07:00
zeekay 40875fb214 client: spell out org-scoping requirements for Threshold.Cancel
Cancel was documented as "cancels a pending session belonging to the
caller's org" but the contract did not name HOW the implementation
enforces that. A loose implementation could:

  - read session, transition state, then check org_id (TOCTOU window)
  - distinguish "not yours" from "not found" in the error message
    (enumeration oracle leaks the existence of cross-org sessions)
  - skip the org predicate when a concurrent legitimate caller also
    has the row open (race condition lets the wrong-org call win)

Tightened doc names the three required behaviors:
  - orgID derived from ctx Claims, not caller-supplied
  - SELECT-FOR-UPDATE + WHERE org_id = ctx.OrgID; mismatch returns
    ErrSessionNotFound (same opaque response as unknown id)
  - row-level CAS with the org predicate in WHERE, so two callers
    cannot race the state transition
  - idempotency on already-cancelled scoped to the SAME org

go.work bumped to 1.26.3 to satisfy the per-module go directive.
2026-05-13 02:47:05 -07:00
zeekay 34f3a6fef8 client: harden Threshold — payload-hash binding, idempotency-key conflict, typed errors, ctx-derived identity 2026-05-13 02:18:05 -07:00
zeekay 0503d2e5fa client: declare canonical Threshold interface 2026-05-13 01:15:54 -07:00