Commit 66141cf
committed
fix(authorize): don't self-heal on ALREADY_DONE — it's a double-callback, not a stale grant
The createCallback self-heal (43b5dfe) put both FAILED_PRECONDITION and
ALREADY_DONE in DEAD_CALLBACK_CODES, pruning the session and bouncing to /login
on either. But mappers.ts maps a code-9 FailedPrecondition whose message matches
/verified|already/i ("auth request already handled") to ALREADY_DONE — the
double-callback case (same requestId re-submitted after it was already finalized:
browser back+reload, duplicate tab, request race), where the session is still
valid. Self-healing there destroys a good session and re-threads the
already-consumed requestId back to /authorize, risking a self-heal loop that
keeps destroying each freshly-minted session.
Only FAILED_PRECONDITION was the staging-confirmed stale-grant code, so narrow
DEAD_CALLBACK_CODES to it. ALREADY_DONE now falls through to the conservative
signin_failed error page with the session left intact — the strictly-safe
pre-fix behavior for that case. The confirmed logout -> re-login self-heal
(FAILED_PRECONDITION) is unchanged.
Flip the stale-grant-callback ALREADY_DONE test to assert the corrected behavior
(no prune, signin_failed, no session_stale event).
Audit finding H-2 (adversarially verified).1 parent 41675f1 commit 66141cf
2 files changed
Lines changed: 37 additions & 20 deletions
File tree
- app/resources/authorize
- cypress/component/resources/authorize
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
Lines changed: 24 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
59 | | - | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| |||
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
73 | | - | |
74 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
75 | 91 | | |
76 | 92 | | |
77 | 93 | | |
| |||
0 commit comments