# Open Source Contribution — Cloudflare Workers SDK (cloudflare/workers-sdk) — PR #16797

> Author: Lokesh Ram Chand, software engineer in Hyderabad. Portfolio: https://lokeshrc.me

> Personal engineering record. Facts below come from the PR, its linked issue, its commits, its review threads, and the source in this repository. Where something is my own interpretation or not recorded anywhere, it says so.

## Overview

PR #16797, titled **"[edge-preview-authenticated-proxy] Restrict suffix redirect to same-origin paths"**, fixed an open-redirect vulnerability in a small Cloudflare Worker that sits inside the `cloudflare/workers-sdk` monorepo. The Worker exposes an endpoint, `/.update-preview-token`, that answers with an HTTP 307 redirect. The redirect target came from a user-controlled query parameter called `suffix`, and the code copied that parameter into the `Location` header without checking it. Anyone could therefore build a link on a Cloudflare-owned preview domain that sent the visitor's browser to any other site.

I reported the problem as issue #16796, with a reproduction commit that contained failing tests. I then wrote the fix in PR #16797. The fix resolves `suffix` against the request URL with the WHATWG URL parser, the same algorithm browsers use. It keeps the value only if the result stays on the same origin and its pathname does not begin with `//`. Everything else falls back to `/`.

The change is small: 3 files, 84 additions and 1 deletion. It had three parts:

1. A new helper function, `getSameOriginRedirect`, in `packages/edge-preview-authenticated-proxy/src/index.ts`.
2. Nine new test cases in `packages/edge-preview-authenticated-proxy/tests/index.test.ts` (eight parameterised hostile inputs and one positive case).
3. A changeset, `.changeset/edge-preview-suffix-same-origin.md`, marking a patch release of `@cloudflare/edge-preview-authenticated-proxy`.

The PR reached state **MERGED** on 2026-11-09 at 14:11:33 UTC, with merge commit `1e1752e462b517280d537c2ed2c95911d2d387cb`. It was approved by a Cloudflare maintainer and by the codeowners check. The whole sequence took roughly one hour: I filed the issue at 13:13 UTC, opened the PR at 13:18, and it merged at 14:11.

The fix is also a good example of how a first-draft fix can still be incomplete. My first version, which followed the simple approach I had proposed in the issue, was beaten by an input class that an automated reviewer found within about a minute. The second round of hardening is the most instructive part of this contribution, and I describe it in detail below.

## Project Context

### What the Project Is

`cloudflare/workers-sdk` is Cloudflare's open-source monorepo for developer tooling around Cloudflare Workers, the company's serverless platform. It contains several things that developers interact with every day:

- **Wrangler**, the command-line tool for developing, testing and deploying Workers.
- **Miniflare**, a local simulator of the Workers runtime built on `workerd`.
- **`create-cloudflare`** (C3), the project scaffolding tool.
- **Vite and Vitest plugins** that let framework-level tooling run code inside the Workers runtime.
- A set of shared packages (configuration handling, authentication, container tooling, deploy helpers and so on).
- Several internal Workers that Cloudflare deploys itself, such as the preview proxies. These are marked in the repo with `"workers-sdk": { "deploy": true }` in their `package.json`.

The repository is managed with `pnpm` workspaces and Turborepo. Release notes are managed with Changesets. Code style is enforced with oxlint and oxfmt. Contribution rules are written down in an `AGENTS.md` file at the root and per package. I read these before making the change, because the root file tells contributors to consult the package guidance, the changeset README and the PR template.

### My Contribution Context

I am an external contributor. I am not a Cloudflare employee and I am not a registered ("vouched") collaborator on the repository. That fact shaped the process: a GitHub Actions bot automatically closed my PR minutes after I opened it, with a message explaining that PRs are limited to registered collaborators and that issues are the preferred way for external contributors to help. The same message said the team might reopen a PR if they decide it is worth reviewing. The PR's final state is MERGED, so a maintainer did reopen and merge it. I did not record who reopened it or when, so I will not claim more than the visible record shows: the merge was performed by the maintainer `cjol` (Christopher Little-Savage), who also approved the PR.

I found the bug by reading the Worker's source, not by being asked to. The contribution workflow I followed was:

1. Read the code and notice the unchecked `Location` assignment.
2. Compare it with the sister Worker `packages/playground-preview-worker`, which protects the same endpoint with extra checks. The difference is what made me confident this was an oversight, not a design choice.
3. Write failing tests first and push them as a standalone commit, so a maintainer could reproduce the bug with one command.
4. File an issue that links the reproduction.
5. Open a PR with the fix, a changeset, and a description following the repository's template.

### Relevant Component

The component is `@cloudflare/edge-preview-authenticated-proxy` (directory `packages/edge-preview-authenticated-proxy`). At the time of the report the package was at version 0.3.4; the `package.json` in my checkout now reads 0.3.5. It is a private package that is deployed as a Worker, not published to npm for users.

Its job is to act as an authenticating front door for **preview sessions**. When a developer edits a Worker in a browser-based environment (for example the Workers dashboard editor or the playground), the UI shows a preview of the Worker running on Cloudflare's edge. That preview is loaded in an iframe on a domain such as `<random-data>.preview.cloudflarepreviews.com`. The proxy has to solve a specific problem: the iframe needs credentials to talk to the preview of the user's Worker, but those credentials (a "preview token") should not be exposed to the page's JavaScript and must be isolated per preview. The proxy does this by:

- Accepting a token through `/.update-preview-token`, storing it server-side in a Workers KV namespace (`TOKEN_LOOKUP`) under a random UUID, and handing the browser an opaque cookie that contains only that UUID.
- On every later request from the iframe, reading the cookie, looking up the token and remote origin, and forwarding the request to the real Worker with a `cf-workers-preview-token` header attached.

The function I changed, `updatePreviewToken`, is the entry point of that flow, and it is reachable by a plain `GET` request from any browser. That is why the `Location` header mattered: this endpoint is meant to be navigated to, so it is an endpoint an attacker can put in a link.

---

# Contributions

## Contribution 1 — Fix open redirect in `/.update-preview-token` by restricting `suffix` to same-origin paths

### Problem

Before the fix, the relevant line in `updatePreviewToken` was:

```ts
Location: url.searchParams.get("suffix") ?? "/",
```

The doc comment for the function describes `suffix` as "(optional) The pathname + search to hit on the preview worker once redirected". The intent is clear: `suffix` should be a path inside the preview. The code did not enforce that. It took whatever string the query parameter held and put it in the `Location` header of a `307 Temporary Redirect`.

A request of this shape therefore redirected off-site:

```
https://abc.preview.cloudflarepreviews.com/.update-preview-token?token=a&remote=https://example.com&suffix=https://evil.example
→ 307 Location: https://evil.example
```

Several families of input all caused off-origin or dangerous behaviour:

| Input in `suffix`   | What the browser does with `Location`                                                  |
| ------------------- | -------------------------------------------------------------------------------------- |
| `https://evil.example` | Follows the absolute URL to another site                                            |
| `//evil.example`    | Treats it as a protocol-relative URL and goes to `evil.example` over the current scheme |
| `/\evil.example`    | Browsers treat `\` like `/` in special-scheme URLs, so this becomes `//evil.example`    |
| `\\evil.example`    | Same backslash normalisation                                                           |
| `javascript:alert(1)` | Passed through unchanged (a redirect to a `javascript:` URL is blocked by modern browsers, but passing it through is still wrong and relies on browser behaviour) |

An open redirect is usually rated as a lower-severity weakness than something like remote code execution, but it has real consequences here:

- **Phishing leverage.** The link starts on a Cloudflare-owned domain (`cloudflarepreviews.com`). Users, mail filters and URL-reputation systems tend to trust the first hostname they see. A link that begins with a Cloudflare domain and ends on an attacker's page is more convincing than one that is obviously foreign.
- **Chaining.** Open redirects can be used to bypass allowlists in other systems, for example OAuth `redirect_uri` checks that validate only the host prefix, or "same-site" URL validators.
- **Side effect before redirecting.** This endpoint also writes to KV (it stores the supplied token under a new UUID) and sets a cookie. A malicious link therefore causes state to be written on the victim's browser and in Cloudflare KV, even though the user ends up on another site.

I want to be careful not to overstate this. I did not claim it was a critical vulnerability, I did not request a CVE, and I do not know of any in-the-wild abuse. The report and the PR describe it factually as an open redirect.

### My Work

My work happened in three stages.

**Stage 1: Reproduce and report.** I added failing tests in a commit titled "[edge-preview-authenticated-proxy] Add failing tests for off-origin suffix redirect" (commit `62fa1db76d374ca16f8066b2fa047ab59b78c561`). The test suite went from 29 passing tests to 34 tests with 5 failing, and each failure printed the offending header, for example `expected 'https://evil.example' to be '/'`. I filed issue #16796, "/.update-preview-token redirects to any URL passed in `suffix`", with:

- the affected versions (workspace state at the time, package 0.3.4, Node v24.18.0, pnpm 10.33.0, Windows 11),
- a link to the reproduction commit,
- a short description of the root cause with the exact line,
- the observation that `playground-preview-worker` already guards the same endpoint with a `Sec-Fetch-Dest: iframe` requirement and an allowlisted `Referer`,
- steps to reproduce (`pnpm exec vitest run -t "off-origin"`),
- expected and actual behaviour,
- a proposed fix: accept `suffix` only when it starts with `/` and the second character is neither `/` nor `\`.

**Stage 2: Implement.** In commit `47b3cbd71b955b6f385f7b00e0001a27c1bc3cd6`, titled "Restrict suffix redirect to same-origin paths", I did not implement the simple prefix check I had proposed in the issue. While writing the code I realised that string-prefix checks are fragile for this class of problem, because browsers normalise URLs before following them. For example, WHATWG URL parsing strips ASCII tab and newline characters from the input. So `/\t/evil.example` does not start with `//` as a string, but after the browser removes the tab it is `//evil.example`. I switched to parsing the value with `new URL(suffix, url)` and comparing origins. The commit message ends with "Fixes #16796".

**Stage 3: Harden after review.** About a minute after the fix commit, an automated reviewer (Devin Review) flagged a problem. I had made origin comparison the core of the check, but a same-origin URL can still produce a dangerous `Location` value. If `suffix` is `/.//evil.example`, the parser resolves it against the request URL, and the origin is the preview origin, so the origin check passes. The resulting `pathname` is `//evil.example`. Because I returned `pathname + search + hash` as a relative `Location`, the browser would see `Location: //evil.example` and treat it as a network-path reference to another host. The same happens with an absolute same-origin URL such as `https://<preview-host>//evil.example`.

I added a second condition, `target.pathname.startsWith("//")`, plus two more test inputs (`/.//evil.example` and the absolute-URL-with-double-slash form). That is commit `2cc74f83e8f5048c42e71c4ec95f619bd5fddd17`, "Reject same-origin suffix paths starting with //".

After this, a different reviewer bot (`clanky-the-clanker`) reviewed that commit and noted that my test list had accidentally acquired a duplicate `"preview.cloudflarepreviews.com"` entry in the neighbouring `should reject token updates on %s` test. A maintainer (`cjol`) applied that suggestion with a commit that co-authors the bot, `9ee04749585d23dc756afac9fd702d81c5a12748`, "Update packages/edge-preview-authenticated-proxy/tests/index.test.ts". The maintainer approved the PR right after, and it merged.

### Technical Implementation

The new helper, as merged, is:

```ts
/**
 * Resolve the `suffix` redirect target so that it can only point at the
 * current origin.
 *
 * The value is resolved with the WHATWG URL parser, as a browser would, so that
 * inputs such as `//host`, `/\host` or paths containing tabs and newlines cannot
 * escape to another origin. A same-origin URL can still have a pathname that
 * starts with `//` (e.g. `/.//host`), which a browser would read as a
 * protocol-relative URL in `Location`, so those are rejected too.
 *
 * @param suffix The raw `suffix` query parameter, if provided
 * @param url The URL of the incoming request
 * @returns A same-origin pathname + search + hash, or `/` if `suffix` is missing or would leave the origin
 */
function getSameOriginRedirect(suffix: string | null, url: URL): string {
	if (suffix === null) {
		return "/";
	}
	let target: URL;
	try {
		target = new URL(suffix, url);
	} catch {
		return "/";
	}
	if (target.origin !== url.origin || target.pathname.startsWith("//")) {
		return "/";
	}
	return `${target.pathname}${target.search}${target.hash}`;
}
```

And the call site changed from the raw parameter to:

```ts
Location: getSameOriginRedirect(url.searchParams.get("suffix"), url),
```

How each decision in the function works:

1. **`suffix === null` returns `/`.** `URLSearchParams.get` returns `null` when the parameter is absent. This preserves the original `?? "/"` behaviour, so a request with no `suffix` is unchanged. An empty string (`suffix=`) is not `null`; `new URL("", url)` resolves to the request URL itself, so an empty `suffix` redirects to the same path (`/.update-preview-token?...`) rather than to `/`. I note this as a minor edge case that I did not change, because a redirect to the same origin is not a security problem; it is only a behavioural curiosity. I did not write a test for it, and I have not verified what happens in a browser when a redirect points back to the token-update endpoint with its query string. If I contributed a follow-up, I would consider treating an empty string like `null`.

2. **`new URL(suffix, url)` inside `try/catch`.** The two-argument URL constructor resolves `suffix` as a relative reference against the request URL, exactly as a browser resolves a `Location` header against the URL that produced the response. If `suffix` is an absolute URL, the base is ignored. If it cannot be parsed at all, the constructor throws a `TypeError`, and the helper falls back to `/`.

3. **`target.origin !== url.origin`.** Origin in the URL standard is a tuple of scheme, host and port for special schemes (`http`, `https`, `ws`, `wss`, `ftp`, `file` is special-cased). For URLs with non-special schemes such as `javascript:` or `data:`, `URL.origin` returns the string `"null"`, which never equals the HTTPS preview origin. So `javascript:alert(1)` fails the same-origin check without needing a scheme blocklist. This is the part of the design I like best: the check is expressed positively as "must equal our origin", so unknown or new URL schemes are rejected by default instead of requiring me to enumerate bad ones.

4. **`target.pathname.startsWith("//")`.** After the origin check, I return `pathname + search + hash` as a relative reference. A relative reference that starts with two slashes is a network-path reference. So I reject pathnames that begin with `//`. This closes the gap that review found. A related detail: a pathname starting with a single `/` followed by `\` cannot occur for `https` URLs, because the parser converts backslashes to forward slashes for special schemes. Thus `/\evil.example` is already normalised to `//evil.example` by the parser. That means the `//` check also covers all of the backslash variants, and the origin check covers the cases where the parser interprets the leading slashes as an authority delimiter.

5. **Returning a reduced path.** On success the function returns only `pathname + search + hash`, never the original string. This matters: even if the parser accepts some oddly formatted input, what goes into the header is the parser's own normalised serialisation. Control characters such as tab and newline are removed by parsing, and the serialisation percent-encodes characters that must be encoded. That prevents the header from carrying raw text from the query string. The `Headers` implementation also rejects values with newlines, but relying on normalised output is a stronger guarantee than relying on that.

The positive example from my own tests shows the normalisation: a same-origin absolute URL `https://random-data.preview.cloudflarepreviews.com/hello?world#section` is reduced to `/hello?world#section`.

**Why `Location` is built as a relative path.** Returning a relative reference is deliberate. Because the helper's output is always a path, the redirect cannot name a host at all (once the `//` case is rejected). That makes the property easy to state and easy to test: the result either is `/` or begins with a single `/` followed by a non-slash character.

**Test additions.** The tests live in `packages/edge-preview-authenticated-proxy/tests/index.test.ts`, which runs under Vitest with the Cloudflare Vitest plugin so that the Worker actually executes in `workerd`. I added:

- A parameterised test using Vitest's `it.for` with eight hostile `suffix` values:
  1. `https://evil.example`
  2. `//evil.example`
  3. `/\evil.example`
  4. `\\evil.example`
  5. `/\t/evil.example` (tab inside)
  6. `/.//evil.example`
  7. `https://random-data.preview.cloudflarepreviews.com//evil.example`
  8. `javascript:alert(1)`

  Each case sends a real `GET` to `/.update-preview-token` with `token`, `remote` and the `suffix` URL-encoded, using `redirect: "manual"` so the test can read the 307 response itself. It asserts that the status is 307 and that the `Location` header is exactly `/`.
- A positive test, "should keep a same-origin absolute suffix as a path", that asserts the `Location` header is `/hello?world#section` for the same-origin absolute URL above.

The test count went from 29 baseline to 38 passing tests, which matches the "All 38 tests in the package pass" statement in the PR body (29 + 8 + 1 = 38).

**Changeset.** The changeset (`.changeset/edge-preview-suffix-same-origin.md`) marks a `patch` bump for `@cloudflare/edge-preview-authenticated-proxy`. Its text states the old behaviour (copied unchanged into `Location`), the examples (`https://…`, `//…`, `/\…`), and the new behaviour (resolved against the request URL, with a fallback to `/`). The `changeset-bot` comment on the PR confirmed it detected one package at patch level.

**PR description.** The description followed the repository's template: tests included, documentation not necessary (with a reason given: this is an internal Worker with no public docs), and a "Fixes #16796" link so that the issue closed automatically on merge.

### Technologies / Concepts

- TypeScript (strict), Cloudflare Workers runtime (`workerd`), Workers KV (for the token store that the changed endpoint writes to).
- The WHATWG URL Standard: parsing, base-URL resolution, origin serialisation, special schemes, opaque origins, backslash handling, tab and newline stripping.
- HTTP semantics: `307 Temporary Redirect`, the `Location` header, relative vs. absolute vs. network-path references (RFC 3986 and RFC 9110).
- Web security: open redirect (CWE-601), input canonicalisation before validation, allow-listing instead of block-listing, cookie attributes (`__Host-` prefix, `Secure`, `HttpOnly`, `SameSite=None`, `Partitioned`).
- Vitest (`it.for` parameterised tests), `@cloudflare/vitest-plugin`, Changesets, pnpm workspaces, Turborepo.
- GitHub workflow: issue-first reporting, test-first reproduction, automated review bots, codeowners checks.

### Result

- The endpoint can no longer be used to redirect a browser to another origin. Every one of the eight hostile inputs in my tests results in `Location: /`.
- Valid paths (the real use case, where the client passes a pathname and search) behave as before, for example `/hello?world`. Same-origin absolute URLs are reduced to a path.
- The package's test suite is 38/38 passing as reported in the PR body, and the change was merged with a maintainer approval and a satisfied codeowners check.
- The fix was released through the repository's normal changeset flow. The git history in my checkout shows a later "Version Packages" commit touching this package and the package version is now 0.3.5. I did not read the generated CHANGELOG entry to confirm that this specific change is listed there, so I am not claiming that.

### Impact

- **Security posture.** Closing an open redirect on a Cloudflare-owned domain removes a phishing and chaining primitive from a domain that users and URL filters trust.
- **Robustness of the approach.** Because the fix canonicalises input with the same parser browsers use and then checks the parsed result, it covers input forms that a string-prefix fix would have missed, such as tab-injected `//` or `/.//`.
- **Regression protection.** The nine tests encode the attack inputs, so future refactors of `updatePreviewToken` cannot silently reintroduce the redirect.
- **Scope of impact is bounded.** The Worker is internal and deployed by Cloudflare, so the audience is users of the browser-based Workers preview experience, not every Wrangler user. I did not measure traffic or exposure and cannot give numbers.

### Pull Request

- URL: https://github.com/cloudflare/workers-sdk/pull/16797
- Title: `[edge-preview-authenticated-proxy] Restrict suffix redirect to same-origin paths`
- Author: `lokeshramchand-ctrl`
- Created: 2026-11-09 13:18:55 UTC. Merged: 2026-11-09 14:11:33 UTC.
- Merge commit: `1e1752e462b517280d537c2ed2c95911d2d387cb`. Merged by `cjol`.
- Size: 3 files changed, +84 / −1.
- Files: `.changeset/edge-preview-suffix-same-origin.md` (new), `packages/edge-preview-authenticated-proxy/src/index.ts` (+31/−1), `packages/edge-preview-authenticated-proxy/tests/index.test.ts` (+46).

### Issue

- URL: https://github.com/cloudflare/workers-sdk/issues/16796
- Title: `[edge-preview-authenticated-proxy] /.update-preview-token redirects to any URL passed in suffix`
- Filed by me at 13:13:35 UTC on 2026-11-09, state CLOSED (closed by the PR via "Fixes #16796").

### Commit(s)

| Commit | Message headline | Purpose |
| ------ | ---------------- | ------- |
| `62fa1db76d374ca16f8066b2fa047ab59b78c561` | Add failing tests for off-origin suffix redirect | Reproduction: 5 failing tests |
| `47b3cbd71b955b6f385f7b00e0001a27c1bc3cd6` | Restrict suffix redirect to same-origin paths | Initial fix using URL parsing and an origin comparison |
| `2cc74f83e8f5048c42e71c4ec95f619bd5fddd17` | Reject same-origin suffix paths starting with // | Hardening after review: close the `//` pathname gap |
| `9ee04749585d23dc756afac9fd702d81c5a12748` | Update `tests/index.test.ts` | Maintainer-applied review suggestion removing a duplicate test entry |
| `1e1752e462b517280d537c2ed2c95911d2d387cb` | (merge commit on `main`) | Landed #16797 |

The PR was merged as one commit on `main`, so the four branch commits are visible in the PR history and the final commit on `main` carries the PR title and number.

### Review / Discussion

The review record, in the order it happened:

1. **`changeset-bot`**: confirmed a changeset for one package at patch level.
2. **`github-actions`**: automatically closed the PR because I am not a registered collaborator, and explained the policy. This was a process notice, not a judgement on the code.
3. **`workers-devprod`**: reported that codeowners approval from `@cloudflare/wrangler` was satisfied, and later posted "Codeowners reviews satisfied".
4. **Devin Review (first pass, on `47b3cbd`)**: raised a security finding labelled "Same-origin suffix redirects to external host". It explained that an absolute same-origin `suffix` ending in `//evil.example` passes the origin check but produces `Location: //evil.example`. This was correct.
5. **Devin Review (second pass, on `2cc74f8`)**: marked the finding "Resolved", noting that the added `pathname.startsWith("//")` check rejects the exact input.
6. **`clanky-the-clanker`** (Cloudflare's review bot, triggered by a maintainer comment): approved with comments. It described the fix as correct and well tested, and raised one optional suggestion, the duplicate `"preview.cloudflarepreviews.com"` entry in a neighbouring test list. It also noted that its review was of the earlier commit `2cc74f8`, not the final head.
7. **`cjol`** (maintainer): triggered the bot review, applied the suggestion, approved the PR at head `9ee0474`, and merged.

---

# Technical Depth

## Architecture / System Understanding

The preview system has three actors:

- **The editor/playground UI** that the developer uses in a browser. It creates a preview session through an authenticated Cloudflare API call.
- **The edge preview proxy** (`@cloudflare/edge-preview-authenticated-proxy`), a Worker deployed on Cloudflare-owned preview domains.
- **The user's preview Worker**, running on Cloudflare's edge and reached via a `workers.dev`-style remote origin, authenticated with a preview token.

The proxy's request handler (`handleRequest`) routes in a fixed order:

1. **Token exchange.** `POST /exchange` on the root preview hostname. The handler fetches an `exchange_url` supplied by the client (after checking it is a valid URL), reads the returned session (including a prewarm URL and token), and returns it. This is how the UI obtains a short-lived preview token from an authenticated core API call.
2. **Preview token update.** `GET /.update-preview-token` on a per-preview subdomain (any hostname ending in `.preview.cloudflarepreviews.com`, not the bare preview hostname). A bare hostname raises an `InvalidPreviewHostname` error, because the endpoint must run on a random subdomain to give each preview its own cookie jar. This is the code path I changed.
3. **Raw HTTP.** Requests on the raw-HTTP hostname are handled by `handleRawHttp`, which lets a client inspect responses from the preview Worker with the raw headers preserved. The source comment says it is not currently used.
4. **Everything else.** Treated as a preview request: parse the `Cookie` header, read the `__Host-token` cookie (the token ID), look the token record up in the `TOKEN_LOOKUP` KV namespace, check that the stored `hostname` equals the request's hostname, then forward the request to the stored `remote` with a `cf-workers-preview-token` header. The proxy also removes `X-Frame-Options` from the response so that the result can be shown in an iframe; the source comment says this is because the Cloudflare error page sets that header.

The token-update flow that my change sits in works like this:

1. The UI loads `https://<random>.preview.cloudflarepreviews.com/.update-preview-token?token=...&remote=...&suffix=...` (typically inside an iframe).
2. The proxy validates that `token` and `remote` exist and that `remote` parses as a URL.
3. It generates `crypto.randomUUID()` as the token ID and stores `{ token, remote, hostname }` in KV with a TTL of two hours, noting in a comment that preview tokens are valid for one hour and the extra hour is margin.
4. It responds with `307` and a `Set-Cookie` header carrying the token ID, and the `Location` of `suffix` so the iframe lands on the page the user wanted.

The design reason for KV is stated in the source: a preview token can be too large for a cookie (the browser limit is about 4096 bytes), so only a UUID goes in the cookie.

The cookie attributes are worth understanding because they explain why the redirect is security-sensitive:

- `__Host-` prefix: requires `Secure`, `Path=/`, and no `Domain` attribute, so the cookie is bound to the exact host.
- `Secure`, `HttpOnly`: not sent over plaintext and not readable by script.
- `SameSite=None` together with `Partitioned`: allows the cookie in a third-party iframe context while partitioning storage by top-level site (CHIPS), which keeps the cookie from becoming a cross-site tracking vector.

The open redirect did not break any of these protections directly. It is a separate flaw in the response of the same endpoint: the cookie is set correctly, but the browser is then sent somewhere unintended.

## Important Components

- **`updatePreviewToken(url, env)`**: the endpoint handler that builds the 307 response. My change touched one line here.
- **`getSameOriginRedirect(suffix, url)`**: the new function. Pure (no I/O, no globals), which made it easy to reason about and to test through the public `fetch` interface.
- **`handleRequest`**: the router and the code that makes sure the update endpoint only runs on per-preview hostnames.
- **`isPreviewUpdateRequest` / `isPerPreviewHostname`**: predicate helpers that decide whether a request is for the update endpoint and whether the hostname is a per-preview subdomain.
- **`TOKEN_LOOKUP` (KV)**: the server-side store for tokens, keyed by random UUID.
- **Error classes** (`InvalidURL`, `TokenUpdateFailed`, `InvalidPreviewHostname`, `PreviewRequestFailed`, `NoExchangeUrl`, `ExchangeFailed`): used with Toucan (Sentry client for Workers) and Prometheus-style metrics (`MetricsRegistry` from `@cloudflare/workers-utils`) for observability. I did not alter them.
- **Test harness**: `tests/index.test.ts` with `exports.default.fetch(...)` calls under `@cloudflare/vitest-plugin`, and a mocked remote (`MOCK_REMOTE_URL`).

## APIs / Interfaces

- **HTTP interface of the changed endpoint**: `GET /.update-preview-token` with query parameters `token` (required), `remote` (required, must parse as a URL), `prewarm` (documented in the comment), and `suffix` (optional). Responses are a `307` with `Location` and `Set-Cookie`, or an error. After my change, `Location` is always either `/` or a path (with optional query and fragment) that starts with a single `/`.
- **Web platform APIs used**: `URL` (constructor with base, `.origin`, `.pathname`, `.search`, `.hash`), `URLSearchParams.get`, and `crypto.randomUUID`.
- **Internal contract**: the helper takes `string | null` and a `URL`, and returns `string`. It never throws.

**Backwards compatibility.** The interface is compatible for callers that follow the documented contract (a pathname plus search). The behaviours that changed are exactly the ones that were abuses: absolute URLs to other origins, protocol-relative forms, backslash forms, and non-HTTP schemes. One side effect is that a same-origin absolute URL is now reduced to a path. That is arguably a normalisation, not a break, because the browser ends up in the same place.

## Data Structures / Algorithms

There are no complex data structures here. The algorithm is a small validation pipeline, and the useful ideas are about **canonicalise-then-validate**:

1. **Canonicalise** the untrusted string using the same parser that will interpret it downstream. The URL parser's state machine handles things string checks do not: stripping leading and trailing C0 control characters and spaces, removing tabs and newlines anywhere in the input, converting `\` to `/` for special schemes, collapsing `.` and `..` path segments, and resolving relative references against a base.
2. **Validate** a property of the canonical form, rather than of the raw input. Here the properties are "origin equals the request origin" and "pathname does not start with `//`".
3. **Emit** the canonical form, not the raw input.

The mistake that review caught is a nice illustration of why a property of the parsed URL is not always a property of the thing you emit. I validated the origin of the parsed URL but then emitted only the path, discarding the origin. A reference to a path is interpreted by a browser relative to the base, and a path of `//host` stops being "a path" once it is interpreted that way. The invariant I needed was about the **emitted** string: it must not be a network-path reference. The additional `startsWith("//")` check restores the invariant.

Another way to enforce that invariant would be to emit an absolute URL (`url.origin + path`). That would make host injection impossible by construction, but it would change the response format and the existing test expectations (which assert relative `Location` values such as `/`). I considered the relative form with the explicit `//` guard the smaller change.

Complexity: the function runs in time linear in the length of `suffix` with constant extra space. Query strings are limited by the platform's maximum URL length, so this is not a concern.

## Distributed Systems Concepts

This change is local and does not alter distributed behaviour, but the surrounding system has several distributed-systems properties that I had to understand to judge the impact:

- **Eventually consistent storage.** Workers KV is eventually consistent across locations. The proxy writes a token and expects to read it back on a subsequent request, which may hit another location. The design copes by redirecting and then reading, with a TTL margin. My change does not touch this path. The redirect is generated after the KV write, so an attacker-controlled redirect does not lengthen or shorten the consistency window.
- **Stateless edge compute.** The Worker holds no state between requests; all session state is in KV and the cookie. That is why the fix could be a pure function with no coordination.
- **Trust boundaries across origins.** The preview runs across three trust domains: the Cloudflare dashboard origin, the preview proxy origin (partitioned cookies, per-preview subdomains), and the user's remote Worker. Open redirects matter most at boundaries like these, where an unvalidated user-controlled value crosses from the "request" side into the "response" side.
- **Rollout.** The proxy is a deployed Worker and its rollout is gradual across Cloudflare's network, so for a short period different edge locations may run different versions. For a fix that tightens validation, this is safe: old and new versions accept the same legitimate inputs.

## Performance Considerations

- The helper adds one URL parse and a few string comparisons per request to `/.update-preview-token`. That is negligible compared with the KV write that the same request already performs.
- The helper allocates one `URL` object per call. The request handler already creates a `URL` for the request, so there is no meaningful additional memory pressure.
- There are no regular expressions, so there is no risk of catastrophic backtracking (ReDoS) from attacker-controlled input. I preferred parser-based validation partly for this reason.
- I did not run a benchmark. The reasoning above is based on the structure of the code and not on measured numbers.

## Testing

- **Approach.** Test-first. I committed the failing tests before the fix, so that the failure was reproducible by anyone and the fix commit demonstrably changed test results from red to green.
- **Where the tests run.** Under Vitest with the Cloudflare Vitest plugin, so requests go through the Worker's real `fetch` handler in `workerd`. This is closer to production than unit-testing the helper in Node, because the URL implementation in `workerd` is the one that matters.
- **Parameterised hostile inputs.** `it.for([...])` with eight cases, each URL-encoded into the query string with `encodeURIComponent`. URL-encoding the tab (`%09`) and backslashes is necessary so the Worker receives them as parameter values and not as part of the request URL's structure.
- **Positive test.** The same-origin absolute URL test makes sure the fix is not simply "always return `/`". Without it, a fix that broke the feature would have passed every negative test.
- **`redirect: "manual"`.** Required so that the test client does not follow the redirect and instead sees the 307 and the `Location` header.
- **Coverage of the classes of attack:** absolute URL, protocol-relative, two backslash forms, whitespace-in-path (tab), dot-segment same-origin double slash, absolute same-origin double slash, and a non-HTTP scheme.
- **What is not covered.** I did not add tests for: an empty `suffix` (see the note above), a very long `suffix`, a `suffix` that includes a fragment-only value such as `#x`, or non-ASCII/IDN hostnames in absolute URLs. These cases fall out of the same logic (parse, compare origin, check the prefix), but they have no dedicated test.
- **Result.** 38 tests passed in the package at the time of the PR, as reported in the PR description. I ran them locally before pushing, and CI ran afterwards.

---

# Engineering Decisions

## Decision 1 — Use the URL parser and compare origins, instead of a string-prefix check

**Context.** My issue proposed the simplest possible fix: accept `suffix` only when it starts with `/` and the second character is neither `/` nor `\`.

**Alternatives considered.**

1. *String-prefix check* (my initial proposal). Simple and obvious, but it validates the raw string, not what the browser will do with it.
2. *Blocklist of schemes and prefixes.* Fragile: new forms get missed.
3. *Parse with the URL API and compare origins.* Validates the same normalised form the browser will see.
4. *Emit an absolute URL built from the request's origin.* Strongest by construction, but changes the output format.

**Decision.** Option 3, followed by a guard on the emitted path.

**Reasoning.** Browsers do not follow the raw header string literally; they run the URL parser, which strips tabs and newlines and converts backslashes. `/\t/evil.example` passes a naive "starts with `/`, second character not `/` or `\`" check because the second character is a tab, yet after parsing it is `//evil.example`. The only reliable way to know where a URL goes is to parse it the way the browser does, and to compare the result with what is allowed. I changed my own proposal before opening the PR, and I said so in the PR description: "Comparing origins after parsing, rather than matching string prefixes, covers inputs such as `/\t/evil.example`".

**Trade-off.** The parser-based approach depends on `workerd`'s URL implementation matching browsers' behaviour. `workerd` follows the WHATWG URL Standard, so I accept this. The primary residual risk is a difference between a browser and the standard in an edge case; the `//` guard also protects against that class of problem for the common cases.

## Decision 2 — Fall back to `/` instead of returning an error

**Context.** When `suffix` is invalid or off-origin there are two sensible responses: reject the request (for example with a 400), or redirect to a safe default.

**Decision.** Redirect to `/`.

**Reasoning.**

- It preserves the existing default (`?? "/"`), so the only behavioural change is for inputs that were already invalid.
- It avoids turning a client-supplied value into a new failure mode in a flow where the token and cookie have already been written. Failing after the KV write would leave orphaned state; failing before it would change the order of operations in the handler.
- The issue's "Expected behaviour" section, and the maintainers' eventual acceptance of the PR, are consistent with a silent fallback.

**Trade-off.** A silent fallback hides client bugs. A developer who passes a bad `suffix` sees the preview open at `/` with no explanation. A log line or a metric for rejected suffixes would help diagnose this, and I did not add one, to keep the diff narrowly scoped to the security fix. This could be a reasonable follow-up.

## Decision 3 — Keep the fix small and local, with tests at the layer where the behaviour lives

**Context.** The repository's guidance prefers narrow, reviewable changes, and a root `AGENTS.md` section tells contributors to put shared behaviour in the lowest suitable shared package. The sister Worker `playground-preview-worker` protects the same endpoint with `Sec-Fetch-Dest` and `Referer` checks.

**Alternatives considered.**

1. Port the `playground-preview-worker` checks (require an iframe fetch and an allowlisted referrer).
2. Extract a shared "safe redirect" utility into `@cloudflare/workers-utils` and use it in both Workers.
3. Fix only `edge-preview-authenticated-proxy` with a private helper.

**Decision.** Option 3.

**Reasoning.**

- Porting header checks would change which requests succeed, potentially breaking legitimate callers that do not send those headers. I could not verify every caller from outside the company, and that is a risky change for an external contributor to make.
- A shared utility is a reasonable future refactor, but extracting it now would enlarge the PR, touch another package, and require more review. The fix needed to land quickly because the bug was a live security issue.
- A private, well-documented, pure function was the smallest change that satisfied the issue's expected behaviour. The JSDoc follows the repository rule of explaining why the function exists and documenting `@param` and `@returns`.

**Trade-off.** If the sister Worker has a similar problem, this fix does not cover it. In the issue I noted that `playground-preview-worker` already guards the endpoint, but I did not audit that Worker's `Location` construction in the PR. That is a possible follow-up.

---

# Challenges

## Challenge 1

**The first fix was incomplete: a same-origin URL can still produce a cross-origin `Location`.**

Within a minute of the fix commit, a reviewer pointed out that `/.//evil.example` and `https://<preview-host>//evil.example` passed my origin check and then produced `Location: //evil.example`.

### How I Solved It

I first confirmed the finding by tracing it by hand. `new URL("/.//evil.example", base)` removes the `.` segment and produces the pathname `//evil.example` on the preview origin. I return `pathname + search + hash`, and a header value beginning with `//` is a network-path reference. The review was right.

I then wrote the failing cases as test inputs first, added the `startsWith("//")` guard, and updated the JSDoc so the function's documented reasoning included the new case (the doc comment now explains why same-origin URLs can still be dangerous). I also updated the PR description so the final write-up explains both guards, and credited the automated review: "Thanks to the automated review for catching this."

### What I Learned

- **Validate the thing you emit, not just the thing you parsed.** I had reduced the problem to "is the origin right?" and forgot that I discard the origin on output. The security property I need is about the final string.
- **A relative reference is not always a path.** Two leading slashes change the meaning of a reference completely. I now think of `//` at the start of a `Location` value as a special case that always needs handling.
- **Automated review is useful for adversarial cases.** It does not replace a maintainer, but it found a real bypass quickly, and it was precise enough to be actionable.
- **Tests should be written for what the code might get wrong, not only what it is meant to do.** Adding the two bypass inputs to the same parameterised list was a one-line change, and it makes the regression permanent.

## Challenge 2

**Working as an external contributor under a policy that auto-closes PRs from non-collaborators.**

Shortly after I opened the PR, a bot closed it, citing the policy that PRs are limited to registered collaborators and that external contributors are encouraged to contribute through issues.

### How I Solved It

I did not argue with the bot or reopen the PR repeatedly. The policy text says issues are welcome and that the team may reopen a PR if they decide to proceed. I had already done the part that policy values most: a clear issue with a minimal reproduction (a commit with failing tests) and an explanation of the cause. I kept the PR description factual and self-contained, kept the PR small and easy to evaluate, and continued to address review findings on the branch. The PR was later reopened and merged by a maintainer. I do not know how the maintainers decided; I only know the outcome.

### What I Learned

- Issue-first contributions with a runnable reproduction are valuable in their own right, because they let a maintainer judge the problem in minutes. The reproduction commit and the issue are the reason this PR could be assessed so fast.
- Projects have good reasons for contribution policies (limited review capacity, concerns about low-effort AI-generated changes). The best response is to make the contribution cheap to review: small diff, tests, a precise description, and a changeset that follows the repository's rules.
- Keeping each commit single-purpose (failing tests, fix, hardening) made the review history easy to follow.

## Challenge 3 (additional)

**Reasoning about browser behaviour without a browser.**

URL handling differs between specifications and implementations, and the question "where would a browser go?" is hard to answer from the code alone.

### How I Solved It

I relied on the WHATWG URL Standard as the ground truth and used `new URL(...)` itself as the oracle, since the parser inside `workerd` implements that standard. The tests run inside `workerd` through the Cloudflare Vitest plugin, so they exercise the parser that the production Worker uses. I turned each reasoning step (for example "tab characters are stripped") into a concrete test input.

### What I Learned

- To test URL security logic, put the actual parser in the loop. A test that checks only strings in Node could pass while the Worker runtime behaves differently.
- Parameterised tests are an effective way to record every reasoning step as an executable case.

---

# Collaboration

## Maintainer / Contributor Interaction

My interaction with maintainers was asynchronous and through GitHub. The visible touchpoints were:

- A maintainer (`cjol`) triggered the Cloudflare review bot by commenting on the PR, so the review ran on the current code.
- The same maintainer applied the bot's suggestion as a commit to my branch, which saved a round trip, then approved and merged.
- The process was fast: roughly 53 minutes from PR creation to merge (13:18:55 to 14:11:33 UTC).

I did not exchange free-form conversation with the maintainers beyond what is on the PR page, and I will not invent any. The record shows that my issue, my PR description and my commit messages carried the communication.

## Code Review

Review feedback came from automated reviewers and a human maintainer:

| Reviewer | Finding | My response |
| -------- | ------- | ----------- |
| Devin Review | Same-origin `suffix` ending in `//evil.example` yields `Location: //evil.example` | Added the `pathname.startsWith("//")` guard and two tests, then the reviewer marked it resolved |
| `clanky-the-clanker` | Duplicate list entry in a neighbouring test | Maintainer applied the suggestion; no further action from me |
| `workers-devprod` | Codeowners approval | Satisfied by the maintainer's approval |
| `cjol` (human maintainer) | Approved the final head and merged | None needed |

Lesson: I responded to findings with code and tests on the same branch, instead of replying to explain. Each response is visible in the commit history.

## Design Discussions

The main design discussion happened inside the PR: whether prefix matching or URL parsing is the right primitive. I made the case in the PR description, which is written so a reader can follow the reasoning without reading the diff. It explains why parsing and origin comparison cover inputs like `/\t/evil.example`, why the `//` check is needed in addition, and which inputs remain unchanged. I did not record a maintainer's written opinion on this question, and the outcome (merged as proposed, with no requested design change) suggests it was acceptable.

## Collaboration Skills Demonstrated

- **Issue-first, reproduction-first.** I opened with a failing-test commit so nobody had to take my word for the bug.
- **Clear written communication.** The issue states versions, cause, expected and actual behaviour, and proposed approach. The PR description states what changed, why, and what stayed the same.
- **Receptiveness to review.** I fixed a real bypass found by an automated reviewer and credited it in the description.
- **Respecting project process.** I followed the template for the PR description, added a changeset and wrote JSDoc as the repository's guidance requires, and I did not push back when the PR was auto-closed.
- **Scoping.** I kept the PR focused on one defect and noted related ideas as follow-ups here instead of expanding the diff.

---

# Outcomes

## Code

- New helper `getSameOriginRedirect` (about 30 lines including JSDoc) and a one-line change at the call site in `packages/edge-preview-authenticated-proxy/src/index.ts`.
- Nine new tests in `packages/edge-preview-authenticated-proxy/tests/index.test.ts`, and a duplicate entry removed from an adjacent test list by the maintainer's suggestion commit.
- One changeset: patch bump for `@cloudflare/edge-preview-authenticated-proxy`.
- Net diff of +84 / −1 across three files; 38 of 38 tests passing in the package at merge time as reported in the PR.

## Project Impact

- Removed an open-redirect weakness from a Worker that runs on a Cloudflare-owned domain.
- Added a documented, tested, pure function that makes the intended contract of `suffix` explicit ("pathname + search on the current origin").
- Left behind a regression suite whose cases double as a list of known bypass techniques for redirect validation, which is useful to the next maintainer who touches this code.

## User / Developer Impact

- Users of browser-based Workers preview experiences are no longer exposed to links that begin on a Cloudflare preview domain and end on an attacker's site through this endpoint.
- Developers and maintainers get a clearer contract and test coverage, so the `Location` handling is no longer implicit.
- I have no usage numbers, abuse reports, or telemetry, and I am not claiming any.

## Recognition

- The PR was approved by a Cloudflare maintainer and merged into `cloudflare/workers-sdk` `main`. This is a direct merge by the project's maintainers.
- My GitHub account is listed as the author of the merged PR and the closed issue.
- There was no bug bounty, CVE, security advisory or public acknowledgement beyond the merge, as far as I know, and I do not claim any. I did not report this through a private disclosure channel; I reported it as a public issue and PR, so it is not something I would describe as a coordinated vulnerability disclosure.

---

# Skills Demonstrated

## Programming

- Strict TypeScript for a Cloudflare Worker: typed helper with a precise signature (`string | null`, `URL`) and a `try/catch` that returns a safe default.
- Correct use of the WHATWG URL API (base resolution, `origin`, `pathname`, `search`, `hash`).
- Writing parameterised tests with Vitest's `it.for`, and writing JSDoc that follows the repository's conventions (purpose, `@param`, `@returns`, and why-comments).

## Software Engineering

- Test-first bug reporting and fixing, with a reproduction commit separate from the fix.
- Incremental, reviewable commits with one purpose each.
- Following repository process: changesets, PR template, issue linking, package-level conventions in `AGENTS.md`.
- Incorporating review feedback quickly and verifying the fix with new tests.
- Choosing the smallest change that closes the defect, and documenting follow-ups instead of widening scope.

## Systems

- Understanding of HTTP redirects and header semantics, including how relative and network-path references are resolved.
- Understanding of how browsers canonicalise URLs (control-character stripping, backslash conversion, dot-segment removal) and how that affects validation.
- Reading an unfamiliar request-routing codebase and tracing the data flow of a query parameter from request to response header.

## Distributed Systems

- Awareness of the edge architecture around the change: stateless Workers, eventually consistent KV, TTLs, per-origin cookie isolation, and gradual rollout.
- Judging that a pure validation change is safe to roll out unevenly because old and new versions accept the same legitimate inputs.

## Infrastructure / Cloud

- Cloudflare Workers, Workers KV, `workerd`, and the Cloudflare Vitest plugin for testing Workers inside the real runtime.
- Monorepo tooling: pnpm workspaces, Turborepo, Changesets.
- Cookie security attributes in practice (`__Host-`, `Secure`, `HttpOnly`, `SameSite=None`, `Partitioned`).

## Open Source

- Finding and reporting an issue in a major open-source project, with a reproduction maintainers can run.
- Contributing under a restrictive contribution policy, and keeping the contribution easy to review.
- Working with a mix of automated and human reviewers.

---

# Evidence

- PR: https://github.com/cloudflare/workers-sdk/pull/16797 (state: MERGED, merge commit `1e1752e462b517280d537c2ed2c95911d2d387cb`)
- Issue: https://github.com/cloudflare/workers-sdk/issues/16796 (state: CLOSED)
- Reproduction commit (failing tests): https://github.com/lokeshramchand-ctrl/workers-sdk/commit/62fa1db76d374ca16f8066b2fa047ab59b78c561
- Branch commits: `62fa1db`, `47b3cbd`, `2cc74f8`, `9ee0474`
- Files changed: `.changeset/edge-preview-suffix-same-origin.md`, `packages/edge-preview-authenticated-proxy/src/index.ts`, `packages/edge-preview-authenticated-proxy/tests/index.test.ts`
- Diff size: 3 files, +84 / −1
- Review artefacts: Devin Review security finding on `index.ts` line 199 and its "Resolved" reply; `clanky-the-clanker` review of `2cc74f8`; maintainer approval at `9ee0474`; `changeset-bot` and `workers-devprod` comments
- Test results quoted in the issue: before the fix, 5 failed and 29 passed (34 total); after the fix, 38 passed (as reported in the PR description)
- Local verification of these facts: `gh pr view 16797` and `gh pr diff 16797` output, plus the source in `packages/edge-preview-authenticated-proxy/src/index.ts`

---

# Key Technical Keywords

Open redirect, CWE-601, HTTP 307, `Location` header, WHATWG URL Standard, URL parsing, origin comparison, opaque origin, protocol-relative URL, network-path reference, backslash normalisation, canonicalisation, input validation, allow-listing, Cloudflare Workers, `workerd`, Workers KV, preview tokens, edge computing, cookies (`__Host-`, `Secure`, `HttpOnly`, `SameSite=None`, `Partitioned`/CHIPS), TypeScript, Vitest, `it.for`, Cloudflare Vitest plugin, Changesets, pnpm workspaces, Turborepo, monorepo, test-first development, regression testing, secure code review, open source contribution.

---

# Related Work

- **Issue #16796**: the bug report that precedes the PR, with its reproduction commit (`62fa1db`).
- **`packages/playground-preview-worker`**: the sister Worker that guards the same endpoint with `Sec-Fetch-Dest: iframe` and an allowlisted `Referer`. A possible follow-up is to audit its handling of `Location` and `suffix` for the same class of bypass, and to consider extracting a shared same-origin redirect helper into `@cloudflare/workers-utils`. I have not done either, and I do not know whether a problem exists there.
- **Possible follow-ups in this package** (none done, listed as ideas only): treat an empty `suffix` as missing; log or count rejected `suffix` values to help developers debug; add tests for fragment-only and non-ASCII inputs.
- **Earlier PRs by me in this repository:** none that I have recorded here. Add them to this section if there are any.

---

# Timeline

All times are UTC on 2026-11-09, from the PR and issue metadata.

| Time | Event |
| ---- | ----- |
| 12:51:59 | Commit `62fa1db`: failing tests for off-origin `suffix` |
| 13:13:35 | Issue #16796 filed with reproduction link |
| 13:17:49 | Commit `47b3cbd`: restrict `suffix` using URL parsing and origin check |
| 13:18:55 | PR #16797 opened |
| 13:19:02 – 13:19:33 | `changeset-bot`, `github-actions` (auto-close notice) and `workers-devprod` comments |
| 13:20:07 | Devin Review flags the same-origin `//` bypass on `47b3cbd` |
| 13:23:07 | Commit `2cc74f8`: reject pathnames starting with `//`, with two new tests |
| 13:36:11 – 13:36:31 | Review bot comments; Devin's second pass marks the finding resolved |
| 13:39:24 | Maintainer comments to trigger a Cloudflare review |
| 13:41:13 | `clanky-the-clanker` review on `2cc74f8`: approved with comments |
| 13:42:42 | Commit `9ee0474`: maintainer applies the duplicate-entry suggestion |
| 13:43:28 | Maintainer approves |
| 13:44:09 | Codeowners review satisfied |
| 14:11:33 | PR merged (merge commit `1e1752e`) |

---

# Notes

- **Sources.** Everything above about the PR, issue, commits, reviews and timeline comes from GitHub metadata retrieved with `gh`, and the behaviour descriptions come from the source in `packages/edge-preview-authenticated-proxy/src/index.ts`. Details I could not confirm are called out in the text (who reopened the PR and why, whether the changelog lists this fix, and the behaviour of an empty `suffix`).
- **Version numbers.** The issue lists the package at 0.3.4. My local `package.json` shows 0.3.5, which includes later release activity, so do not assume 0.3.5 is the first version containing the fix without checking the changelog.
- **Terminology.** "Open redirect" is the accurate category for this defect. I deliberately avoid calling it a "critical" or "high severity" vulnerability, since I have not assessed severity formally and it has no CVE.
- **Attribution.** The reviewer tools mentioned (Devin Review and Cloudflare's review bot) are automated; the human maintainer is `cjol`.
