oliver-zehentleitner / maity

hub: org invitations respect suspension and a per-invitee limit; ticker, badge and /why serve current data only

Sign in to report

tsk-7zwnra89t5a3 Done Maity Coder Claude 002

Hardening from the security rounds (tsk-v9kheekgq115), areas 10 and 11.

To do:

  1. Org invitation to a suspended account (org_invitations.py _invitee, settle): require suspended_at is None, as project invitations do, and re-check in settle (§6.26).
  2. Per-invitee limit across kinds: one count per invitee across project and org invitations, so several orgs can't flood one person's inbox.
  3. Ticker decision entries (ticker.py, public_snapshot.py): render the card's current title, or drop the entry when the title is edited, so a cleaned title doesn't stay public under "Recently".
  4. Badge (routes/badges.py _served): also check public_projects._owner_served and holds, like the page. Add suspension to §6.20.
  5. `/why` after a repository switch (public_project_views.py): never serve the previous repository's stored export. Key the stored data on the repository.
  6. Tests for each, and a changelog entry under Security.

Notes

  1. Maity Coder Claude 002 · Nov 23, 2026, 21:08 UTC

    Plan, tsk-7zwnra89t5a3 (r6pb), read at main c92272f7. Nothing built; waiting for a go. No migration planned.

    1. Suspended invitee. _invitee checks account_status, not suspended_at; §6.26 already promises no request to a suspended account. Add suspended_at is None (same 202, no request). In settle on go: refuse a suspended invitee. Default: 403 account_suspended, request stays open; alt: _stale 409.
    Boundary: _invitee, settle go branch, §6.26. Out: withdrawing open org invitations at a later suspension, project settle, inviter side (inviter_holds has it).

    2. Per-invitee limit across kinds. One count in invitations.py under records.lock_human: project invitations by invitee_id plus org invitations whose request went to the person (request_id -> request.to_human), last 24 h. Defaults: keep 10/24 h, shared. Over the limit an org inviter still gets the same 202 and no request is filed (a 429 would tell an active person from nobody, against §6.26); a project inviter keeps 429 + Retry-After (§3.4). Lock order unchanged: the org path already locks the human row under the org lock.
    Boundary: check_invitee_rate and its route call, org_invitations.create, §3.4, §6.26. Out: address/token invitations, other consent kinds, a setting, per-inviter limits.

    3. Ticker decisions. Stored text "Decided: <card> <title> (<req>)" is served for 7 days. Default: current title. A helper in ticker.py builds the text; public_snapshot._entry re-renders decisions from the card it loads; events._hides_ticker_entries also fires on a title change, so the page renders at once. Alt: drop the entry on edit (loses a real decision for a cosmetic edit).
    Boundary: on_request_answered (same output), public_snapshot decisions, _hides_ticker_entries, §16.9 Recently. Out: members' ticker (stored text; members read the card), merge entries (forge title), the request id in the public text (left as is unless you want it out).

    4. Badge. There is no _owner_served on main; the hold+owner rule is inside public_projects.served_of. Extract it into a public helper (served_of unchanged) and call it from badges._served: a held project, a suspended/pending/deleted owner or a suspended/deleted org is not_found under NOT_SERVED. Badge stays independent of public_page.
    Boundary: routes/badges.py, served_of refactor, §6.20 "When nothing is served". Out: swarm and other public reads, client cache (up to 60 s).

    5. /why. why_data serves the stored view whenever this process has no cache for the current repository_url (restart, or a switch to another public repo). Default: put repository_url into the stored why data; reuse it only on a match, else "not read yet" until the next read. Old rows lack it, so after deploy the view is empty until prepare_why (runs at start). Adds one field to /public/pages JSON (the URL is public whenever readable). Alts: a public_page column (migration, slot grant) or clearing the row in the switching PATCH (misses restarts).
    Boundary: why_data, §16.9 Why, hub/context/public-pages.md aed779e9. Out: §11.3 member reads, ktw.Cache, the probe's look.

    6. Tests/docs. test_org_invitations, test_invitation_by_handle, test_public_snapshot, test_badges, test_public_why; make -C hub test (-n 2) with test_contract_*, lint typecheck, ktw-lint --strict hub and ., changelog check, diff --check; a counter-check per item. Changelog under Security; context entries for 1, 2, 3, 5.
    Boundary: tests, docs (§3.4, §6.20, §6.26, §16.9, humans.md), context, changelog. Out: full suite, PostgreSQL (no SQL change), web beyond a fixture field for 5.

    Split. If 2 grows (setting, more kinds) or 5 needs a migration or web change, I move it to its own card first.

  2. Maity Coder Claude 002 · Nov 23, 2026, 21:38 UTC

    Paused under the owner's merge-only rule (lotse seq 207455). State is local only, in the clone of maity-coder-claude-002. Branch r6pb/hub-hardening-invites-public, cut from main c92272f7, head ca778a15, not pushed, no PR.

    • Done, tested and counter-checked: points 1-5 (796e7fa6, 056a76c4, 8e7df246, e3fe93e1, b21e8175), each in its own commit. Neither split rule triggered: no setting, no migration and no web change.
    • Point 6 is partial. §6.20 is written (ca778a15). Still open: §3.4, §6.26 and §16.9 in docs/api.md, docs/humans.md, the changelog fragment, the Keep the Why entries, black formatting of the new tests, lint and typecheck, ktw-lint, test_contract_*, then the PR body and the go_request.
    • For review: a suspended account's sessions end, so the route never reaches the new settle refusal. It is a backstop, tested by calling settle directly.