Commit 2d50aff
fix(cloud): re-seed SSO redirect_uris on hostname change to prevent INVALID_CALLBACK_URL
When a user changed an environment's hostname via the change_hostname
action, the project's sys_oauth_application row was left holding the
OLD hostname in its redirect_uris whitelist. The next OAuth2 flow from
the per-env runtime to cloud then failed with:
{"message":"Invalid callbackURL","code":"INVALID_CALLBACK_URL"}
…because cloud's better-auth oauth-provider rejected the new
`https://<new-hostname>/api/v1/auth/oauth2/callback/<provider>` URI.
Fix: extract the post-provision SSO seed block into a reusable
`reseedPlatformSsoForHostname()` helper and invoke it from BOTH
change_hostname paths (the action-dispatch handler used by Cloud
Control's UI button AND the explicit `/cloud/environments/:id/change-hostname`
REST route). The existing `seedPlatformSsoClient()` is already designed
to MERGE new redirect URIs into the existing row (it never drops old
ones), so a rename is safe even if the user later moves back.
trustedOrigins already accepts `https://*.objectos.app` via
OS_TRUSTED_ORIGINS, so CSRF is unaffected — only the per-client
redirect_uris whitelist needed updating.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 563b085 commit 2d50aff
1 file changed
Lines changed: 66 additions & 0 deletions
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
42 | 101 | | |
43 | 102 | | |
44 | 103 | | |
| |||
360 | 419 | | |
361 | 420 | | |
362 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
363 | 425 | | |
364 | 426 | | |
365 | 427 | | |
| |||
477 | 539 | | |
478 | 540 | | |
479 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
480 | 546 | | |
481 | 547 | | |
482 | 548 | | |
| |||
0 commit comments