🐛 BUG: Routes do not work if api token is restricted to zone
See original GitHub issueWhat version of Wrangler
are you using?
0.0.0-21ee93e
What operating system are you using?
Linux
Describe the Bug
- Restrict API token to a zone, for example:
Account - Workers R2 Storage:Edit, Workers Tail:Read, Workers KV Storage:Edit, Workers Scripts:Edit, Account Settings:Read
example.com - Workers Routes:Edit
All users - User Details:Read
- Try to deploy to
routes = ["https://example.com/*"]
- Error:
⛅️ wrangler 0.0.0-21ee93e
---------------------------
Uploaded test-worker (1.71 sec)
✘ [ERROR] Received a bad response from the API
Authentication error [code: 10000]
Not sure if this is related with the zone inference or a bug on Cloudflare’s side
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Routes · Cloudflare Workers docs
Routes allow users to map a URL pattern to a Worker script to enable Workers to run in front of Custom Domains or...
Read more >Use API Keys with Routes API | Google Developers
This guide shows how to create, restrict, and use your API key for Google Maps Platform. ... If the Routes API is not...
Read more >Resolve API Gateway REST API 403 “Missing Authentication ...
When I try to invoke my Amazon API Gateway REST API, I get 403 "Missing Authentication Token" error messages. How do I troubleshoot...
Read more >Prisma Access Known Issues - Palo Alto Networks
Authentication override values in portal and gateway configurations are not accepted when the following conditions apply: You have a Mobile ...
Read more >Restricting Access with HTTP Basic Authentication | NGINX Plus
If the provided name and password do not match the password file, you get the 401 (Authorization Required) error.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👋 Any update on this issue?
Having to generate a token that can control workers routes across all zones in an account seems like a pretty big security risk to me, and this seems like a pretty major regression over v1?
Latest update…
In Wrangler 1, you had to specify the zone_id and so it was able to hit a zone specific REST endpoint that only updated the routes on that one zone.
The problem is that in Wrangler 2 we avoid you having to write out your zone_id by inferring it from the routes. The REST endpoint that we hit to do this accepts a list of routes and will work out which zones to publish to.
In order to do this the endpoint currently requires that you have permission to access “all zones” before it will even trigger the underlying logic that does the upload. The permission checking is done in a layer before the application logic, which means that it doesn’t necessarily have the same fine-grain understanding. The security layer would need to do the mapping from routes to zones in order to know whether you have permission to run the application logic, which is going to do the same mapping.
We have two proposed options to resolve this:
Obviously the first option is the preferred one and we should have an idea of whether this is a goer by the end of this week. The second option is much more clunky and would also slow down publishing Workers as we would need to do additional requests.