oliver-zehentleitner / maity
runners and placements (bug): a suspension or re-pair revokes a runner credential without runner_credential_gone
tsk-mrt77xgrexx4 Done An agent
From the clean-up audit tsk-hgnbapyw7hnh, Area 9 (Runners and placements), read at 80647565. Every line number is at that SHA; check it against current main first. This is audit finding 13, filed on its own because it is probably a bug, not a clean-up. Paths are under hub/src/maity_hub/.
This may also concern the security team: it is a gap in what happens when a runner credential is revoked (pickups fetched with an old credential stay usable). No security card covers it (searched: runner_credential_gone, re-pair, closing placement, credential_revoked). tsk-mknw2my8zq4c covers a different revoke gap (agent credentials of closed placements on a stop).
What is wrong
Revoking a runner credential (auth/leaks.py:191, revoke_runner_credential) does not close closing placements and does not revoke unused pickups. Each caller has to remember to call placements.runner_credential_gone (placements.py:897-904) as well.
- These callers do it: the revoke route (
routes/runners.py:636-637) and the leak path (auth/leaks.py:182-186). - The removal path is covered by
runner_removed. - The suspension does not (
moderation.py:199-200). A placement that is alreadyclosingon that runner staysclosinguntil someone deletes it: no live credential is left to send the terminal report, and nothing callsclose_now. The DELETE escape (routes/placements.py:681) does close it at once, but nothing closes it on its own. - The re-pair does not either (
routes/runners.py:461-463). Pickups fetched with the old credential stay unrevoked, against the docstring atplacements.py:898-899("Its unused pickups end with the credential that fetched them").
Proposal
- Call
runner_credential_gonefrom insiderevoke_runner_credential, and drop the separate calls at the revoke route and the leak path. - Tests: after a suspension, a
closingplacement on that runner is closed; after a re-pair, a pickup fetched with the old credential is refused.
Open question
- Is the re-pair meant to end the old credential's pickups?
docs/api.md:17453-17454names only "revoking or removing the runner". Confirm before changing the re-pair path, and update that sentence either way.
Order
- tsk-mknw2my8zq4c (security, in progress) is changing
runner_revoke.pyandroutes/runners.py. Do this after it, or coordinate with its holder. - tsk-f5sdcgr7vzj0 item 2 moves
revoke_runner_credentialout ofauth/leaks.pyintoauth/revocation.py. Whichever goes second rebases; the fix is the same in either place. - tsk-cnyz6bb2vhkx (moderation clean-up) touches
moderation.pynear the suspension; rebase rather than conflict. - The runner clean-up card (audit 2, one "revoke and tell" helper) touches the same functions. Do this bug first.
Effort S. Risk low to medium: it changes behaviour on suspension and re-pair, so each needs its own test.