-
Notifications
You must be signed in to change notification settings - Fork 5
ci: assert WorkOS OAuth refresh metadata #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,17 +61,27 @@ In the WorkOS environment referenced by `WORKOS_AUTHORIZATION_SERVER_URL`: | |
|
|
||
| ## 3. Smoke tests | ||
|
|
||
| ### Automated metadata smoke | ||
|
|
||
| ```sh | ||
| ISSUER="<WORKOS_AUTHORIZATION_SERVER_URL>" | ||
|
|
||
| # AS metadata: 200 with registration_endpoint + S256 | ||
| curl -s "$ISSUER/.well-known/oauth-authorization-server" \ | ||
| | jq '{registration_endpoint, code_challenge_methods_supported}' | ||
|
|
||
| # DCR is open: expect 201 + client_id | ||
| curl -s -X POST "$ISSUER/oauth2/register" \ | ||
| # AS metadata: 200 with registration_endpoint, S256, and refresh support | ||
| curl --fail --silent --show-error --location \ | ||
| "$ISSUER/.well-known/oauth-authorization-server" \ | ||
| | jq --exit-status ' | ||
| .registration_endpoint != null | ||
| and (.code_challenge_methods_supported // [] | index("S256")) != null | ||
| and (.grant_types_supported // [] | index("refresh_token")) != null | ||
| and (.scopes_supported // [] | index("offline_access")) != null | ||
| ' > /dev/null | ||
|
|
||
| # DCR is open: expect 201 + client_id. A refresh-capable client must register | ||
| # both authorization_code and refresh_token. | ||
| curl --fail --silent --show-error -X POST "$ISSUER/oauth2/register" \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{"client_name":"smoke","redirect_uris":["https://example.com/cb"],"grant_types":["authorization_code"],"response_types":["code"]}' | ||
| -d '{"client_name":"smoke","redirect_uris":["https://example.com/cb"],"grant_types":["authorization_code","refresh_token"],"response_types":["code"],"token_endpoint_auth_method":"none"}' \ | ||
| | jq --exit-status '.client_id != null' > /dev/null | ||
|
|
||
| # PRM: resource + authorization_servers | ||
| curl -s https://mcp.terminal49.com/.well-known/oauth-protected-resource | jq | ||
|
|
@@ -85,6 +95,36 @@ curl -si -X POST https://mcp.terminal49.com/mcp \ | |
| # aud == https://mcp.terminal49.com | ||
| ``` | ||
|
|
||
| CI follows the preview deployment's authorization-server metadata redirect and | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Describe this as a production metadata check. CI no longer follows the preview deployment's metadata redirect: the workflow hard-codes |
||
| fails if `grant_types_supported` omits `refresh_token` or `scopes_supported` | ||
|
Comment on lines
+98
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The workflow does not follow the preview deployment’s metadata redirect: Useful? React with 👍 / 👎.
Comment on lines
+98
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This text says CI follows the preview deployment’s authorization-server redirect, but the workflow requests the fixed production Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/mcp/WORKOS_MCP_SETUP.md
Line: 98-99
Comment:
**Correct the validated environment**
This text says CI follows the preview deployment’s authorization-server redirect, but the workflow requests the fixed production `mcp.terminal49.com` URL. Maintainers can therefore mistake successful CI for evidence that preview-specific OAuth configuration advertises refresh support.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||
| omits `offline_access`. These capabilities belong in the WorkOS authorization | ||
| server metadata, not the Terminal49 Protected Resource Metadata (PRM). | ||
|
|
||
| ### Human refresh smoke | ||
|
|
||
| Refresh requires a real user authorization. Do not store a user password in CI. | ||
| Run the local [OAuth test client](./OAUTH_TEST_CLIENT.md), which requests | ||
| `openid profile email offline_access` and registers both | ||
| `authorization_code` and `refresh_token` grant types. | ||
|
|
||
| 1. Click **Authorize** and complete the WorkOS sign-in. | ||
| 2. In the redacted token output, confirm the response contains a | ||
| `refresh_token` and the access token `aud` is | ||
| `https://mcp.terminal49.com`. | ||
| 3. Click **Refresh**. The client posts `grant_type=refresh_token`, the current | ||
| refresh token, and `resource=https://mcp.terminal49.com` to the discovered | ||
| token endpoint using the same registered client. | ||
| 4. Confirm the refreshed response contains a new `access_token` whose `aud` | ||
| is still `https://mcp.terminal49.com`. | ||
| 5. Click **Tools List** and confirm `tools/list` succeeds with the refreshed | ||
| bearer token. | ||
| 6. If WorkOS returns a replacement `refresh_token`, retain it for the next | ||
| refresh. The local test client does this automatically; it keeps the | ||
| previous refresh token only when the response omits a replacement. | ||
|
|
||
| The test client redacts tokens and client secrets in its browser output. Do not | ||
| copy credentials into CI output, shared shell history, or issue comments. | ||
|
|
||
| ## 4. Per-client notes | ||
|
|
||
| - **ChatGPT (Apps SDK)** and **Claude connectors** connect **server-side** — no | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore the credential guard around preview-only steps. The metadata assertion requests the fixed production URL in
AUTHORIZATION_SERVER_METADATA_URLand does not consume either the Vercel deployment orsteps.preview.outputs.endpoint. However, this change also removesif: steps.credential.outputs.available == 'true'fromWait for this commit's Vercel preview,Resolve Vercel preview endpoint, andVerify preview still belongs to this commit. WhenMCP_EVAL_TOKENis unavailable, both matrix jobs now wait for and validate a Vercel preview even though the authenticated preview smoke is skipped; only the2026-07-28job then performs the independent production metadata check. A delayed deployment, missing Vercel status, or missing/churned bot comment can therefore fail CI for reasons unrelated to this assertion. Please restore the credential guard on those three preview-only steps so the production metadata assertion can run independently. Alternatively, if the preview is intended to be tested, use the resolved preview origin in the assertion.