Commit d96922d
Validate audience matches resourceUrl for embedded auth server (#4904)
* Validate audience matches resourceUrl when embedded auth server is active (#4860)
The embedded auth server mints tokens with aud set to the ResourceURL
(the RFC 8707 resource parameter), but the token validator checks aud
against the user-specified OIDCConfigRef.Audience. When these diverge,
every authenticated request fails silently.
Add reconciler-time validation requiring audience == resourceUrl when an
embedded auth server is configured, with a clear error message guiding
operators to fix the mismatch. This mirrors the existing validation in
the vMCP inline config path (ValidateAuthServerIntegration).
Fixes #4860
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Extract audience validation into shared helper and improve error messages
Consolidate the duplicated audience/resourceUrl validation from
AddEmbeddedAuthServerConfigOptions and AddAuthServerRefOptions into
validateOIDCConfigForEmbeddedAuthServer. Add a distinct error for
empty audience (missing field) vs mismatched audience (wrong value)
to help operators identify the root cause faster.
Document the rationale for validation-based enforcement (Option D)
over silent override (Option A): operators see exactly what values
are in play and control both sides explicitly, consistent with the
existing vMCP inline config validation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix integration tests to set matching audience and resourceUrl
Integration test fixtures set OIDCConfigRef.Audience but not
ResourceURL, so the resolver auto-computed a different ResourceURL
from the proxy/server name. The new audience validation correctly
rejects this mismatch.
Set ResourceURL to match Audience in all embedded auth server
integration test fixtures so the audience consistency check passes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 03f5025 commit d96922d
5 files changed
Lines changed: 111 additions & 22 deletions
File tree
- cmd/thv-operator
- controllers
- pkg/controllerutil
- test-integration
- mcp-remote-proxy
- mcp-server
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| |||
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
757 | | - | |
| 758 | + | |
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 398 | + | |
| 399 | + | |
404 | 400 | | |
405 | 401 | | |
406 | 402 | | |
| |||
418 | 414 | | |
419 | 415 | | |
420 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
421 | 453 | | |
422 | 454 | | |
423 | 455 | | |
| |||
759 | 791 | | |
760 | 792 | | |
761 | 793 | | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
| 794 | + | |
| 795 | + | |
768 | 796 | | |
769 | 797 | | |
770 | 798 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1110 | 1110 | | |
1111 | 1111 | | |
1112 | 1112 | | |
| 1113 | + | |
1113 | 1114 | | |
1114 | 1115 | | |
1115 | 1116 | | |
| |||
1118 | 1119 | | |
1119 | 1120 | | |
1120 | 1121 | | |
| 1122 | + | |
1121 | 1123 | | |
1122 | 1124 | | |
1123 | 1125 | | |
1124 | 1126 | | |
1125 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1126 | 1148 | | |
1127 | 1149 | | |
1128 | 1150 | | |
| |||
1665 | 1687 | | |
1666 | 1688 | | |
1667 | 1689 | | |
| 1690 | + | |
1668 | 1691 | | |
1669 | 1692 | | |
1670 | 1693 | | |
| |||
1738 | 1761 | | |
1739 | 1762 | | |
1740 | 1763 | | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
1741 | 1794 | | |
1742 | 1795 | | |
1743 | 1796 | | |
| |||
1813 | 1866 | | |
1814 | 1867 | | |
1815 | 1868 | | |
| 1869 | + | |
1816 | 1870 | | |
1817 | 1871 | | |
1818 | 1872 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
120 | 122 | | |
121 | | - | |
122 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| |||
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
200 | | - | |
201 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
| |||
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
379 | | - | |
380 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
381 | 384 | | |
382 | 385 | | |
383 | 386 | | |
| |||
0 commit comments