Commit 05a8ed7
committed
fix(security): prevent unauthorized OAuth consent approval via HTTP
The /oauth/consent/approve HTTP endpoint was publicly accessible on
localhost:45818 with no authentication, allowing any local process
(including malicious scripts) to auto-approve MCP client authorization
requests without user interaction. This is how clients like Cursor
could bypass the deep-link consent flow entirely.
Changes:
- Remove /oauth/consent/approve HTTP endpoint from production router
(consent now exclusively via Tauri IPC command)
- Add cryptographic consent_token to PendingAuthorization, generated
per-request and shared only via Tauri IPC (get_pending_consent) —
must be returned on approval to prove legitimacy
- Add 2-second UI cooldown on Approve button to prevent programmatic
instant approval
- Add per-path rate limiting middleware on OAuth endpoints
(authorize, token, register, clients)
- Guard approve_oauth_client Tauri command behind MCPMUX_E2E_TEST
env var (was unrestricted "for E2E testing")
- Conditionally re-enable HTTP consent endpoint only when
MCPMUX_E2E_TEST=1 for E2E test compatibility
Signed-off-by: Claude <noreply@anthropic.com>
https://claude.ai/code/session_019gtFefwPpKWZH73DEyUpE2
Signed-off-by: Claude <noreply@anthropic.com>1 parent 9c63e49 commit 05a8ed7
6 files changed
Lines changed: 252 additions & 11 deletions
File tree
- apps/desktop
- src-tauri/src/commands
- src/components
- crates/mcpmux-gateway/src/server
- tests/e2e/helpers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
| |||
360 | 364 | | |
361 | 365 | | |
362 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
363 | 377 | | |
364 | 378 | | |
365 | 379 | | |
| |||
373 | 387 | | |
374 | 388 | | |
375 | 389 | | |
| 390 | + | |
376 | 391 | | |
377 | 392 | | |
378 | 393 | | |
| |||
390 | 405 | | |
391 | 406 | | |
392 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
393 | 411 | | |
394 | 412 | | |
395 | 413 | | |
| |||
453 | 471 | | |
454 | 472 | | |
455 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
456 | 495 | | |
457 | 496 | | |
458 | 497 | | |
| |||
504 | 543 | | |
505 | 544 | | |
506 | 545 | | |
| 546 | + | |
507 | 547 | | |
508 | 548 | | |
509 | 549 | | |
| |||
656 | 696 | | |
657 | 697 | | |
658 | 698 | | |
659 | | - | |
660 | | - | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
661 | 703 | | |
662 | 704 | | |
663 | 705 | | |
664 | 706 | | |
665 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
666 | 712 | | |
667 | 713 | | |
668 | 714 | | |
| |||
674 | 720 | | |
675 | 721 | | |
676 | 722 | | |
677 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
678 | 727 | | |
679 | 728 | | |
680 | 729 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| 129 | + | |
| 130 | + | |
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| |||
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
135 | 150 | | |
136 | 151 | | |
137 | 152 | | |
| |||
178 | 193 | | |
179 | 194 | | |
180 | 195 | | |
| 196 | + | |
181 | 197 | | |
182 | 198 | | |
183 | 199 | | |
| |||
211 | 227 | | |
212 | 228 | | |
213 | 229 | | |
| 230 | + | |
214 | 231 | | |
215 | 232 | | |
216 | 233 | | |
| |||
467 | 484 | | |
468 | 485 | | |
469 | 486 | | |
470 | | - | |
| 487 | + | |
471 | 488 | | |
472 | 489 | | |
473 | 490 | | |
474 | 491 | | |
475 | 492 | | |
476 | 493 | | |
477 | | - | |
| 494 | + | |
478 | 495 | | |
479 | 496 | | |
480 | 497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
139 | 144 | | |
140 | 145 | | |
141 | 146 | | |
| |||
272 | 277 | | |
273 | 278 | | |
274 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
275 | 292 | | |
276 | 293 | | |
277 | 294 | | |
| |||
285 | 302 | | |
286 | 303 | | |
287 | 304 | | |
| 305 | + | |
288 | 306 | | |
289 | 307 | | |
290 | 308 | | |
| |||
850 | 868 | | |
851 | 869 | | |
852 | 870 | | |
| 871 | + | |
853 | 872 | | |
854 | 873 | | |
855 | 874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
308 | 309 | | |
309 | 310 | | |
310 | 311 | | |
| |||
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
320 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
321 | 337 | | |
322 | 338 | | |
323 | 339 | | |
| |||
328 | 344 | | |
329 | 345 | | |
330 | 346 | | |
331 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
332 | 351 | | |
333 | 352 | | |
334 | 353 | | |
| |||
0 commit comments