afterhours-shift-manager/tests
Adam Moussa 43bfbf34c2 Fix auth and race-condition flaws in shift commands
Four confirmed findings from the 2026-06-17 security sweep:

- register_user let any Slack user overwrite an extension already
  bound to a different user (account takeover). Add a DynamoDB
  ConditionExpression so a write only succeeds when the extension is
  unclaimed or already this user's; raise ExtensionAlreadyRegistered
  otherwise and surface a clear Slack message.
- The `rate` subcommand was routed without the is_admin flag, so any
  user could set $0 pay rates. Gate _handle_rate on is_admin, matching
  the admin-command guard.
- `/oncall pick` used a plain put_item (TOCTOU): two concurrent picks
  both won. Use the atomic claim_open_shift conditional claim so the
  loser gets an "already picked up" message.
- swap-accept overwrote a shift independently claimed after the swap
  was initiated. Add reassign_if_held_by, a conditional write that only
  applies the swap while the override is still the requester's (or on
  the weekly fallback), and notify the accepter otherwise.

Add tests for the register-ownership guard and the rate admin guard.

Refs: INFRA
2026-06-18 11:55:57 -04:00
..
holiday_router Fix holiday router 3CX IVR calls (Receptionists entity, not IVRs) (#124) 2026-06-17 12:04:10 -04:00
release_notifier Add changelog-driven releases and App Home tab (#112) 2026-06-11 19:41:31 -04:00
ring_scheduler Add pytest suite and wire it into CI (#85) (#86) 2026-06-01 19:07:08 -04:00
roster_sync Add pytest suite and wire it into CI (#85) (#86) 2026-06-01 19:07:08 -04:00
scripts Add changelog-driven releases and App Home tab (#112) 2026-06-11 19:41:31 -04:00
shared Fix holiday router 3CX IVR calls (Receptionists entity, not IVRs) (#124) 2026-06-17 12:04:10 -04:00
slack_bot Fix auth and race-condition flaws in shift commands 2026-06-18 11:55:57 -04:00
weekly_post Add holiday shifts with 3CX routing and late-pickup approval (#121) 2026-06-17 11:14:29 -04:00
conftest.py Add holiday shifts with 3CX routing and late-pickup approval (#121) 2026-06-17 11:14:29 -04:00
requirements.txt Add pytest suite and wire it into CI (#85) (#86) 2026-06-01 19:07:08 -04:00