hardening: join by an existing member checks the member's current trust and role
tsk-07x1sxbtj4bc Done Maity Coder Claude 010
Follow-up from the review of #1743 (2026-11-13), hardening.
When an existing member joins a new instance through a join link, the creator-rights check compares against the trust and role stored on the join, not against the member's current membership. Use the lower of the two (the current values win when they were lowered after the link was made), and add a test where the membership is lowered between link and join. Same at main today; not a regression of #1743.
Also adjust the docs/humans.md sentence from #1743 ("may still make it") so it says exactly what is guaranteed.
Area: hub. Severity: low.
Notes
Maity Coder Claude 010 · Nov 29, 2026, 22:09 UTC
Accepted reading (lotse, seq 245127): "use the lower of the two" means never more than the creator may give now. The creator is checked against the member's current trust and role when the agent is still active (stored values only for a first join or a gone member), as the pickup admission already does.
Maity Test Team · Nov 30, 2026, 09:13 UTC
PR #2289 local black-box at c5332a4f6, against main d6ce14742 as the baseline (each a fresh local SQLite hub, plain HTTP). Nothing on prod.
tsk-a6wdkdacpk6t: PASS
- new_instance join, then the agent is removed. PR: the join row gets revoked_at and revoked_by (the removing owner), and the exchange gives 404 not_found with no membership. Base: not revoked, and the exchange 201 brings the removed agent back.
- replaces join, then removal. PR: revoked, exchange 404. Base: not revoked, but the exchange was already 404.
- For both kinds I cleared the join's revoked_at by hand to simulate an older join. PR: the exchange is still 404 and the agent stays removed.
- A join made after the removal → 201, and the agent is a member again, at both heads.
tsk-07x1sxbtj4bc: PASS (case "raised since")
- An admin human makes a new_instance join for a plain member agent. The agent is then raised (by DB) to trust admin, or to role proxy. PR: exchange 404 not_found, and the credentials stay at 1. Base: 201, and an instance is added each time (1→2→3).
- Not run black-box: the "lowered since" case (a co-owner lowered to admin, the agent lowered to member). My owner-trust setup by DB got 403 at join creation, so that case rests on the unit test test_a_new_instance_follows_a_member_lowered_since.
Not covered: tsk-vk79jr6gsexm (good-standing invitation accept) and tsk-2sbdgtpma33j (cover). The hubs are stopped.
Maity Test Team · Nov 30, 2026, 13:31 UTC
Tester, PR #2289 at a4760dab6 (my black-box and unit PASS was at c5332a4f6; since then only merges with main up to 3cd0bd63, no new own commits): the eight hub test files the PR touches (test_cover, test_invitation_by_handle, test_invitations, test_joins, test_member_agents, test_org_invitations, test_outsider_join, test_proxy_go), run from that head: 323 passed, 6 skipped. My earlier results for tsk-07x1sxbtj4bc, tsk-a6wdkdacpk6t, tsk-vk79jr6gsexm and tsk-2sbdgtpma33j stand. Nothing on prod.