Repository navigation
feat: serve OpenAI apps domain challenge from secret - #230
Merged
Merged
Conversation
Answer https://agentrelay.com/.well-known/openai-apps-challenge with the bare token from the OPENAI_APPS_CHALLENGE_TOKEN Worker secret (text/plain, 200), 404 when unset or blank. Apex host only, before any upstream dispatch so the token never reaches the traffic recorder. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Session-Id: e4b9f1e5-e901-4bea-8fc8-1f08bd07c6d3 Session-Id: e4b9f1e5-e901-4bea-8fc8-1f08bd07c6d3
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
|
Preview deployed!
This is a Cloudflare Workers preview version of this PR's build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
OpenAI verifies ChatGPT app domain ownership by fetching
https://agentrelay.com/.well-known/openai-apps-challengeand comparing the bare token. Today that path falls through to the marketing site and returns a Next.js HTML 404.This repo's router is the only Worker on the prod
agentrelay.comapex (cloudinfra/web.ts: the SSTAgentRelayRouteris gated!isProd). So this is the layer that has to answer.Supersedes #207, which has the same idea. This PR adds:
wrangler deploy. Here the token ships throughdeploy-router.yml's--secrets-file, exactly likeANALYTICS_VISITOR_HASH_SECRET.main.What
/.well-known/openai-apps-challenge:GET/HEAD→200 text/plain; charset=utf-8withcache-control: no-store. The body is only the trimmed token: no HTML, JSON or redirect.404 text/plain.405, without the token.deploy-router.ymlpassesOPENAI_APPS_CHALLENGE_TOKENfrom GitHub Actions secrets into the--secrets-file. When the secret is absent nothing is written, so the path 404s.Making it live (human steps)
gh secret set OPENAI_APPS_CHALLENGE_TOKEN -R AgentWorkforce/agentrelay.com. It is also in Settings → Secrets → Actions.maintouchingrouter/**or the workflow triggers Deploy Router (Cloudflare). That job waits for the same commit's Deploy Web run, then deploys with the secret.workflow_dispatch.curl -si https://agentrelay.com/.well-known/openai-apps-challengeshould return200,text/plain, and only the token.Verification
cd router && vitest run: 11 files, 111 tests pass. The newtest/openai-apps-challenge.test.tshas 9 tests: 200 with only the token, trimming, HEAD, 404 when undefined/empty/blank, 405, apex-only, and neighbouring paths.tsc --noEmit -p router/tsconfig.json: clean.No deploy, secret or DNS change was made.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Low Risk
Adds an isolated early-return route and optional deploy secret; no changes to auth, payments, or existing routing when the path or secret is unused.
Overview
Adds OpenAI apps domain verification at
https://agentrelay.com/.well-known/openai-apps-challenge. The router answers that path before any upstream routing so the token is never proxied or recorded.When the
OPENAI_APPS_CHALLENGE_TOKENWorker secret is set, GET/HEAD return 200 with plain text (trimmed token,no-store). Missing or blank secret → plain 404 (not marketing HTML). Other methods → 405 without exposing the token. Only the exact path on the agentrelay.com apex qualifies.Deploy Router now includes
OPENAI_APPS_CHALLENGE_TOKENin the optional--secrets-filebundle (same pattern as analytics hashing). If the GitHub secret is absent, nothing is written and the path 404s.New Vitest coverage exercises success, trimming, HEAD, unset secret, method/host/path edge cases, and confirms cloud worker is not invoked.
Reviewed by Cursor Bugbot for commit 6ad57dd. Bugbot is set up for automated code reviews on this repo. Configure here.
Agent Relay sessions
claudesessione4b9f1e5· opened viagh pr create· last active 2026-10-16