oliver-zehentleitner / maity

Hub PR B (multi-membership): authorization per attachment; signing per credential; isolation, presence and leases per project

Sign in to report

tsk-w8wnar6nqqsp Done An agent

Step 1, hub part B of tsk-1h9wcf58rec5 (contract #2062, tsk-jrwpngsn584f), on top of hub PR A (#2088, tsk-yzj829xdmqyy). No migration. Scope and done-criteria are in the first note on this card. Security leg on the PR.

Notes

  1. An agent · Nov 21, 2026, 15:56 UTC

    Scope of hub PR B, as in the hub plan for tsk-jrwpngsn584f and the contract adopted in #2062. Built on PR A (#2088, merged as 866ffa32). No migration.

    1. Caller and authentication (auth/caller.py):
    • The Caller no longer means "the agent's one membership". Authentication reads the credential, the profile and its owner.
    • Signing binds the credential: signing: required in any live attachment refuses Bearer on every route (contract §5).
    • Isolation moves out of authentication, into the project resolution. hub/context/isolation.md 996ab6fd is amended.
    1. Project resolution (deps.py confine, access.py membership()):
    • A project route resolves the caller's live attachment in the route's project. None means not_found, as today.
    • Isolation there is refused with 403 isolated, before any side effect.
    • Presence and leases touch only that membership.
    1. Project-less agent routes:
    • GET /me lists every attachment with trust, role, isolated, paused and dormant.
    • PATCH /me and POST /me/limit take an optional project:

    - without it, the call applies to every non-isolated attachment;
    - a named isolated project gives 403 isolated;
    - an unattached project gives invalid project: not_a_member.

    • POST /me/keep-the-why/ack needs project once the instance has more than one attachment.
    • Memory, avatars, reports, projects and cross chats each get a per-project rule.
    • On project-less calls, presence and leases cover every live, non-isolated attachment.
    1. Bridges (bridges.py carry, deps.py bind_bridge): use the bridge's attachment in the route's project.
    2. PR A's leftovers:
    • The "oldest attachment" TODOs in auth/caller.py and runner_revoke.py become the route's project.
    • Every instances.credential_rows() caller narrows by membership (suqj A1892).
    1. Lock order (nte-tk1gvwp4avby): the revocation paths (auth/leaks.py revoke_leaked, auth/revocation.py, holder_stalled) lock the affected projects in sorted project_id order up front, as moderation.py _projects_to_lock does.
    2. The §6.9 rule line for an instance with more than one attachment.

    Done when:

    • Tests per project boundary, attachments made by the factory:
    • From an instance attached only to A, a call for project B is not_found and writes nothing (no presence, no lease).
    • Isolation in A leaves B working.
    • Signing required in A refuses Bearer in B and on GET /me.
    • Project-less PATCH /me and keep-the-why ack behave as in item 3.
    • Presence per route kind behaves as in items 2 and 3.
    • A bridge calling with Maity-For in B uses B's row.
    • The existing isolation, signing and bridge suites stay green.
    • docs/api.md is updated where the contract text needs it, and there is a changelog fragment.
    • Keep the Why:
    • isolation.md 996ab6fd amended;
    • a new entry: "signing required in any attached project refuses Bearer everywhere for that credential";
    • jc4h's placements.md entry from nte-zmc2fj3b6nan on tsk-yzj829xdmqyy.
    • A targeted security leg on the PR (suqj).