Commit 1169b3f
fix(codex): demote scope validation to warn-only (raphaeltm#772)
* fix(codex): demote scope validation to warn-only to unblock token refresh
The scope validation added in PR raphaeltm#756 (MEDIUM #6) blocks Codex OAuth token
refresh with 502 when OpenAI returns any scopes beyond the hardcoded allowlist
(openid, profile, email, offline_access). Since we don't yet know the full set
of scopes OpenAI returns in practice, this was silently breaking all Codex
token refreshes — expired tokens couldn't be renewed, causing "Authentication
required" errors.
Changes:
- Default CODEX_SCOPE_VALIDATION_MODE to 'warn' (log but allow)
- Add CODEX_SCOPE_VALIDATION_MODE env var to opt back into 'block' mode
- Update tests to cover both warn and block behaviors
- The unexpected_scopes_allowed log line will reveal what scopes OpenAI
actually returns, so we can update the allowlist and re-enable blocking
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: trigger CI with updated PR body
---------
Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent b1dbdde commit 1169b3f
3 files changed
Lines changed: 110 additions & 24 deletions
File tree
- apps/api
- src
- durable-objects
- tests/unit/durable-objects
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
290 | 295 | | |
291 | 296 | | |
292 | 297 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
297 | 305 | | |
298 | 306 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
303 | 322 | | |
304 | 323 | | |
305 | 324 | | |
| |||
363 | 382 | | |
364 | 383 | | |
365 | 384 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
370 | 388 | | |
371 | | - | |
372 | | - | |
| 389 | + | |
| 390 | + | |
373 | 391 | | |
374 | 392 | | |
375 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| |||
Lines changed: 76 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | | - | |
| 602 | + | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
606 | | - | |
| 605 | + | |
| 606 | + | |
607 | 607 | | |
608 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
609 | 641 | | |
610 | 642 | | |
611 | 643 | | |
| |||
628 | 660 | | |
629 | 661 | | |
630 | 662 | | |
631 | | - | |
| 663 | + | |
632 | 664 | | |
633 | 665 | | |
634 | 666 | | |
| |||
660 | 692 | | |
661 | 693 | | |
662 | 694 | | |
663 | | - | |
| 695 | + | |
664 | 696 | | |
665 | 697 | | |
666 | 698 | | |
| |||
683 | 715 | | |
684 | 716 | | |
685 | 717 | | |
686 | | - | |
687 | | - | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
688 | 725 | | |
689 | 726 | | |
690 | 727 | | |
| |||
709 | 746 | | |
710 | 747 | | |
711 | 748 | | |
712 | | - | |
| 749 | + | |
713 | 750 | | |
714 | 751 | | |
| 752 | + | |
715 | 753 | | |
716 | 754 | | |
717 | 755 | | |
| |||
737 | 775 | | |
738 | 776 | | |
739 | 777 | | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
740 | 807 | | |
741 | 808 | | |
742 | 809 | | |
| |||
0 commit comments