Repository navigation
fix(router): arelay.to is HTTPS only - #157
Conversation
http://arelay.to served pages and accepted chat messages over plain HTTP. GET/HEAD now redirect permanently to HTTPS; other methods get a 308 whose body names the HTTPS URL (curl does not follow redirects, so the agent sees what to use) and the message is never processed or forwarded. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="router/index.ts">
<violation number="1" location="router/index.ts:518">
P3: A trailing-dot FQDN in the Host header (`http://arelay.to./…`) bypasses this HTTPS-only gate because `url.hostname` keeps the trailing dot (`"arelay.to."`), which matches neither `SHORT_HOST` nor `SHORT_HOST_WWW`. Normalize the hostname (strip a trailing `.`) before comparing so every form of the short host gets the same HTTPS-only treatment.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
Preview deployed!
This is a Cloudflare Workers preview version of this PR's build. |
…S gate Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@coderabbitai review |
|
Bug
http://arelay.to/agent-relayreturned 200 over plain HTTP, and a chat POST tohttp://arelay.to/agent-relay/<id>was processed. Visitors' messages and our agent's replies could travel unencrypted.agentrelay.comalready redirects (its zone's Always Use HTTPS setting); the arelay.to zone doesn't have it. Reported by the founder.Fix (in the router, so it's in source control rather than a dashboard toggle)
getInsecureShortHostResponseruns first infetchforarelay.toandwww.arelay.tooverhttp::https:.locationset and the plain-text bodyagent-relay: use HTTPS: https://…. Agents'curldoesn't follow redirects, so the agent sees the HTTPS URL in its output. The message is not processed or forwarded: a test asserts the upstreamfetchis never called.The snippet and guide already use
https://, so this only affects someone typinghttp://.Validation
Router: 109/109 tests (4 new) and typecheck clean. With #154, this router change deploys only after its commit's web deploy.
Follow-up (not in this PR)
Turning on Always Use HTTPS and HSTS on the arelay.to zone would also cover any path the router doesn't see. That's a production zone setting, so it's a human step.
🤖 Generated with Claude Code
Note
Medium Risk
Changes edge routing for a security-sensitive agent-chat entry host; behavior is narrow (HTTP-only on two hostnames) but blocks previously accepted plain-HTTP chat POSTs.
Overview
Enforces HTTPS for
arelay.toandwww.arelay.toin the router so agent chat and pages are no longer served or forwarded over plain HTTP (the short host’s zone lacks Cloudflare “Always Use HTTPS,” unlikeagentrelay.com).A new early gate,
getInsecureShortHostResponse, runs at the start offetchforhttp:requests to those hosts (including FQDN hosts with a trailing dot). GET/HEAD get a 301 to the same path and query onhttps:. All other methods (e.g. chat POST) get 308 with aLocationheader and a plain-text bodyagent-relay: use HTTPS: …so tools likecurlthat do not follow redirects still see the correct URL; those requests are not proxied upstream.HTTPS traffic and other hostnames are unchanged. Tests cover redirects, 308 bodies, trailing-dot hosts, and an integration case that upstream
fetchis never called for HTTP chat POSTs.Reviewed by Cursor Bugbot for commit 74026a4. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Makes
arelay.toHTTPS-only so agent chat messages and replies no longer travel unencrypted over plain HTTP. Trailing-dot hosts likearelay.to.are treated the same asarelay.to.http://arelay.toget a permanent (301) redirect to the same HTTPS URL.curl(which doesn't follow redirects) prints what to use; the message is never processed or forwarded.Written for commit 74026a4. Summary will update on new commits.
Agent Relay sessions
claudesession1e2adfbe· opened viagh pr create· last active 2026-10-08claudesessiona4302a83· contributor · rangh prcommands · last active 2026-10-08