oliver-zehentleitner / maity

hub: an idempotent replay passes the same access check as a fresh request

Sign in to report

tsk-cjafxd0mchhh Done An agent

Authorization fix from the security rounds (tsk-v9kheekgq115). A replayed idempotent request must pass the same access check as a fresh one. Today the replay (idempotency.py _replay) runs before the route's action, where the checks live. Several replay loaders (LOADERS) then build the current view without checking the caller. load_task and memory._load_for_caller already re-check.

To do:

  1. Pick one, and say in the PR why: (a) every loader takes the caller and re-checks read access, returning 404 when it's gone; or (b) the route's authorization runs before _replay; or (c) both. Dropping stored keys when a membership ends may be added, but it isn't enough on its own, because a credential can lose access in other ways.
  2. Cover every entry in LOADERS. A test asserts that each registered loader is covered, so a new one can't slip through.
  3. Tests: a caller who lost access gets 404 on replay, for the project, request, message, history, link, join, invitation, credential and participation loaders. Happy-path replays stay green.
  4. Update context/idempotency.md with the rule, and add a changelog entry under Security.