Skip to content

Commit

Permalink
Ignore OPTIONS requests in Oauth server (#5324)
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa committed Mar 20, 2024
1 parent 641aa9c commit bfc4282
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-mice-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: Ignore OPTIONS requests in Wrangler's oauth server

This comment has been minimized.

Copy link
@petebacondarwin

petebacondarwin Mar 21, 2024

Contributor

@penalosa - for future reference, I think it would be helpful to include information about symptoms of the problem that the user would have seen and the fact that this was needed to fix a change in Chrome, mentioning the version etc, so that it makes it easier for users to identify this release as solving that problem.

1 change: 1 addition & 0 deletions packages/wrangler/src/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ export async function login(

assert(req.url, "This request doesn't have a URL"); // This should never happen
const { pathname, query } = url.parse(req.url, true);
if (req.method !== "GET") return res.end("OK");

This comment has been minimized.

Copy link
@petebacondarwin

petebacondarwin Mar 21, 2024

Contributor

It always makes me sad when we land fixes without corresponding tests.
I appreciate that this was a hot-fix and also that we probably don't have any tests set up to check this part of the code (is that right?).
But we should always take note of these cases and think about improving the test coverage in these parts of the code going forward.

switch (pathname) {
case "/oauth/callback": {
let hasAuthCode = false;
Expand Down

0 comments on commit bfc4282

Please sign in to comment.