Commit 92bbd15
committed
fix(admin): forward session cookie on KeyViz fan-out so peers do not 401
PR #686 shipped fan-out with the design assumption that peers
would accept anonymous calls on a private network (#685 3). But
the receiving side runs the same SessionAuth middleware as the
browser-facing path, so anonymous fan-out calls are rejected with
401 missing-session-cookie -- the cluster heatmap collapsed to
"1 of N nodes responded" in any production-like deploy.
Fix: forward the inbound user's cookies on every peer call so the
peer's SessionAuth middleware sees a valid principal. Cluster nodes
already share --adminSessionSigningKey for HA, so a cookie minted on
node A is verifiable on node B without any new infrastructure.
Behaviour delta:
- KeyVizFanout.Run gains a cookies []*http.Cookie parameter; nil
preserves the legacy unauthenticated behaviour for tests / future
non-browser callers.
- The handler passes r.Cookies() so a SPA poll forwards admin_session
and admin_csrf transparently.
- New TestKeyVizFanoutRunForwardsCookies pins that both cookies
reach the peer verbatim.
Design doc 3 rewritten: the "anonymous on a private network" claim
was wrong (the earlier draft assumed the peer side would also be
anonymous, which is not how the admin path is built). Phase 2-C MVP
now documents cookie-forwarding plus the operator-trust assumption
that --keyvizFanoutNodes points at trusted hosts only. Phase 2-C+
will replace cookie forwarding with a dedicated inter-node token so
browser-session expiry and inter-node call validity are decoupled.
Tested against a 6-node cluster: with this fix the heatmap shows
all 6 nodes (was 1 of 6 with anonymous calls).1 parent edaaa64 commit 92bbd15
4 files changed
Lines changed: 113 additions & 30 deletions
File tree
- docs/design
- internal/admin
Lines changed: 29 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
151 | 164 | | |
152 | 165 | | |
153 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
208 | 216 | | |
209 | 217 | | |
210 | | - | |
| 218 | + | |
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
| |||
218 | 226 | | |
219 | 227 | | |
220 | 228 | | |
221 | | - | |
| 229 | + | |
222 | 230 | | |
223 | 231 | | |
224 | 232 | | |
| |||
260 | 268 | | |
261 | 269 | | |
262 | 270 | | |
263 | | - | |
| 271 | + | |
264 | 272 | | |
265 | 273 | | |
266 | 274 | | |
| |||
274 | 282 | | |
275 | 283 | | |
276 | 284 | | |
277 | | - | |
| 285 | + | |
278 | 286 | | |
279 | 287 | | |
280 | 288 | | |
281 | 289 | | |
282 | 290 | | |
283 | 291 | | |
284 | 292 | | |
285 | | - | |
| 293 | + | |
286 | 294 | | |
287 | 295 | | |
288 | 296 | | |
| |||
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
295 | 315 | | |
296 | 316 | | |
297 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
155 | 200 | | |
156 | 201 | | |
157 | 202 | | |
| |||
176 | 221 | | |
177 | 222 | | |
178 | 223 | | |
179 | | - | |
| 224 | + | |
180 | 225 | | |
181 | 226 | | |
182 | 227 | | |
| |||
209 | 254 | | |
210 | 255 | | |
211 | 256 | | |
212 | | - | |
| 257 | + | |
213 | 258 | | |
214 | 259 | | |
215 | 260 | | |
| |||
238 | 283 | | |
239 | 284 | | |
240 | 285 | | |
241 | | - | |
| 286 | + | |
242 | 287 | | |
243 | 288 | | |
244 | 289 | | |
| |||
258 | 303 | | |
259 | 304 | | |
260 | 305 | | |
261 | | - | |
| 306 | + | |
262 | 307 | | |
263 | 308 | | |
264 | 309 | | |
| |||
322 | 367 | | |
323 | 368 | | |
324 | 369 | | |
325 | | - | |
| 370 | + | |
326 | 371 | | |
327 | 372 | | |
328 | 373 | | |
| |||
369 | 414 | | |
370 | 415 | | |
371 | 416 | | |
372 | | - | |
| 417 | + | |
373 | 418 | | |
374 | 419 | | |
375 | 420 | | |
| |||
416 | 461 | | |
417 | 462 | | |
418 | 463 | | |
419 | | - | |
| 464 | + | |
420 | 465 | | |
421 | 466 | | |
422 | 467 | | |
| |||
458 | 503 | | |
459 | 504 | | |
460 | 505 | | |
461 | | - | |
| 506 | + | |
462 | 507 | | |
463 | 508 | | |
464 | 509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
182 | 187 | | |
183 | 188 | | |
184 | 189 | | |
| |||
0 commit comments