Skip to content

build(deploy): forward only the API's paths through the cloud's sign-in relay - #2914

Merged
fforootd merged 2 commits into
mainfrom
claude/cloud-app-approach-review-26ad98
Nov 10, 2026
Merged

fforootd merged 2 commits into
mainfrom
claude/cloud-app-approach-review-26ad98

Conversation

@fforootd

@fforootd fforootd commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Context

  • None: found in a review of the hosted cloud's Vercel setup.

Summary

  • The relay forwarded any path on the origin. /cloud/zitadel/<plain path> went to the server's origin, which on the cloud is every other service's too: /cloud/zitadel/docs fetched the docs, /cloud/zitadel/cron/events-retention the cron trigger, and /cloud/zitadel/cloud/zitadel/… the relay again, one more function invocation per nested prefix. On a preview each of those calls carried the protection-bypass secret. Production deploys the route too, although its console does not use it.
  • It now forwards /api/v1/… alone and answers 404 req.not_found to everything else, before the bot check and before any fetch. The sign-in widget calls nothing else: it has put the prefix after its base since feat!: call the API under /api/v1 #2359.
  • ADR 084 §5 says so.
  • apps/cloud/README.md lists the seventh service, go-import, and roots the server service at apps/api, as vercel.json does.

Validation

  • turbo run test typecheck lint --filter=@zitadel/cloud-functions (6 tasks, all pass; src/sign-in.spec.ts 21 tests)
  • node scripts/check-adrs-index.mjs
  • node scripts/check-pr-title.mjs --title "…"
  • After review: isApiPath also refuses . and .. segments (a request's URL arrives with them resolved, so the relay already refused /api/v1/../../docs), with tests.
  • Not run locally: the deployment suites. This PR's preview runs them; the console and CLI suites sign in and sign up through the relay.

Release notes / changeset

  • No changeset required — no shipped behavior changed. @zitadel/cloud-functions is the hosted cloud's backend and is in the changesets ignore list.

Notes

🤖 Generated with Claude Code

…in relay

The relay under /cloud/zitadel forwarded any plain path to the server's
origin, which every other service shares: the docs, the website, the
functions themselves (one more invocation per nested /cloud/zitadel), each
call with a preview's protection-bypass secret. It now forwards
/api/v1/... alone, which is all the sign-in widget calls, and answers 404
to the rest.

apps/cloud/README.md names the seventh service (go-import) and the server
service's root.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 04:17
@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Nov 10, 2026 4:47am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-10T04:20:48.641817Z 038037e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ No Changeset found

Latest commit: 39909cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

Approval is blocked because isApiPath can be bypassed via dot-segment paths that normalize outside the /api/v1/ prefix, and there is no regression test covering this escape vector, with a related ADR needing an update to match the new forwarding behavior.

3 open issues
What changed in this PR

Tightens the hosted cloud’s sign-in relay so /cloud/zitadel/... only forwards Resource API traffic (/api/v1/...), reducing exposure of non-API paths on the shared Vercel origin.

Changes:

  • Restrict relay forwarding to /api/v1/... and return 404 req.not_found for all other paths before bot-check/fetch.
  • Update and extend unit tests to reflect the API-only relay contract and rejection behavior.
  • Align ADR 084 and cloud deployment documentation with the updated relay behavior and current service layout.
File Description
docs/​adrs/​084-hosted-cloud-business-systems.md Updates ADR 084 documentation around hosted cloud systems, including the sign-in relay/BotID behavior and referenced request paths.
apps/​cloud/​README.md Refreshes the hosted cloud deployment/service documentation, including the service list and corrected service roots.
apps/​cloud-functions/​src/​sign-in.ts Implements API-only gating for the sign-in relay so only /api/v1/... paths are forwarded and all others are rejected with a 404 envelope.
apps/​cloud-functions/​src/​sign-in.spec.ts Adjusts and extends relay tests to validate API-only forwarding and expected 404 behavior for disallowed paths.

Review effort: Balanced

Comment thread apps/cloud-functions/src/sign-in.ts Resolved
A request's own URL arrives with its dot segments resolved, so
/cloud/zitadel/api/v1/../../docs already reached the relay as
/cloud/zitadel/docs and was refused. isApiPath now refuses "." and ".."
itself, for any caller that hands it an unresolved path, and ADR 084
names the prefixed flow writes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@fforootd
fforootd added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit ee78298 Nov 10, 2026
26 checks passed
@fforootd
fforootd deleted the claude/cloud-app-approach-review-26ad98 branch November 10, 2026 04:49
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Nov 10, 2026

This branch was successfully deployed

1 active deployment
Preview — 39909cc6 Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants