Commit b467685
committed
fix(auth): fail closed when a KNOWN org's session policy cannot be read
Review catch, and the reviewer is right that the previous comment described
behavior the code no longer had. `getSessionPolicy` now throws, so the create
hook's catch covered two different failures and answered both the same way.
They deserve opposite answers:
- Org KNOWN — membership resolved, only the policy read failed. This user is
definitely governed by an org, so the "would break sign-in for everyone"
rationale simply does not apply. Fail closed. Minting a full-length session
for a member whose policy could not be read is the exact outcome the feature
exists to prevent, and the blast radius is org members during a window where
the `organization` read fails while the `member` read just succeeded.
- Org UNKNOWN — both membership reads failed, so a governed member is
indistinguishable from the majority who belong to no org. Failing closed here
would take authentication down for everyone to protect a policy most of them
do not have. Allow, and let the update hook clamp retroactively.
Throwing an APIError from this hook is the established pattern in this file —
the blocked-email check directly above does the same.1 parent 8b928f5 commit b467685
1 file changed
Lines changed: 30 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
| 700 | + | |
708 | 701 | | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
714 | 730 | | |
715 | 731 | | |
716 | 732 | | |
717 | 733 | | |
718 | 734 | | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
| 735 | + | |
724 | 736 | | |
725 | 737 | | |
726 | 738 | | |
| |||
0 commit comments