[workers-auth] Reject misleading Cloudflare Access 302 redirects

Open Beginner friendly
#16,755 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@akhil9tiet is already working on this.

Since Nov 6, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start in workers-auth/access.ts and inspect domainUsesAccess(), then review the linked Node.js reproduction. Check how the redirect's Location value is parsed and how supported Cloudflare Access team domains are identified. Done means misleading URLs return false while valid Access redirects still return true; run the relevant workers-auth tests.

Written by the indexing model from the issue text.

Description

bug package:workers-auth
What versions & operating system are you using?

Source-level regression in workers-auth/access.ts on main.
Reproduction tested with Node.js v22.16.0 on Linux.
No live Cloudflare Access environment was used.

Please provide a link to a minimal reproduction

https://gist.github.com/aetherxeg-source/f513b2d7deed578bcf60478d6162f8fa

Describe the Bug

The domainUsesAccess() function detects Cloudflare Access when an HTTP 302 response has a Location header containing the substring cloudflareaccess.com.

This can incorrectly classify unrelated redirects, including:

  • https://team.cloudflareaccess.com.evil.test/login
  • https://unrelated.test/next?url=https://team.cloudflareaccess.com/

Expected: Parse the redirect URL and validate the actual HTTPS hostname against the supported Cloudflare Access team domains.

Actual: The current substring check returns true for misleading URLs.

A standalone Node.js reproduction is linked above. This is a source-level regression, not a confirmed production exploit.

This issue follows the maintainer's request in #16604 to track HTTP 302 Location validation separately from Managed OAuth 401 handling.

Please provide any relevant error logs

No response

Dominant language
TypeScript
Stars
4.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
257

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/workers-sdk

All issues in cloudflare/workers-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.