Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow OPTIONS requests through domain proxy #7284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
code-asher merged 3 commits into coder:main from helgehatt:main
Apr 14, 2025
Merged

Conversation

@helgehatt
Copy link
Contributor

@helgehatt helgehatt commented Mar 27, 2025

Fixes #7283

I believe the fix is as simple as allowing OPTIONS requests to pass through the proxy without authentication. Then the service behind the proxy should respond with 200 or 204.

@helgehatt helgehatt requested a review from a team as a code owner March 27, 2025 08:04
Copy link
Member

code-asher commented Mar 27, 2025
edited
Loading

This is probably OK, but something about letting things through the proxy to the app without auth is making me nervous. Would it work if we just respond with a 204 here?

Copy link
Member

Also thank you for working on this!

Copy link
Member

And I suppose we will need to do the same for the path-based proxy.

Copy link
Member

Actually, I suppose we have to let it through because it could be a 404 or something else, no way to know for sure that particular preflight will actually be a 204.

Will approve once we add it to the path proxy as well!

Copy link
Member

code-asher commented Mar 27, 2025
edited
Loading

Sorry to keep going back and forth 😅

But I was thinking if we do pass it through, that exposes information (which ports have things on them) and maybe we should just hardcode a 204 after all...trying to see what other things do like oauth2-proxy to see if there is some standard. edit seems they have a skip-auth-preflight flag?

Copy link
Contributor Author

What do you think is the right direction here? A skip-auth-preflight flag is definitely an option, but hardcoding adds a layer of security by obscurity. However, hardcoding 204 kind of defeats the purpose of preflighting requests.

Copy link
Member

code-asher commented Apr 1, 2025
edited
Loading

hardcoding 204 kind of defeats the purpose of preflighting requests

Yeah, you are right, but the attack surface is large since we automatically forward every port, so it makes me nervous. A hardcoded response would eliminate the attack vector, and would probably be good enough for development?

But, I think for now my vote would be to gate this behind a skip-auth-preflight flag set to false by default. Or I suppose it could take a list of port numbers.

What do you think?

Copy link
Contributor Author

We can start off with a boolean skip-auth-preflight flag which can later be extended with a list of ports or a hardcoded mode?

Copy link
Member

That sounds good to me!

Copy link
Contributor Author

@code-asher Have a look and see if these changes make sense to you.

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Perfect thank you!

@coder coder deleted a comment from codecov bot Apr 14, 2025
@code-asher code-asher merged commit bbf2e24 into coder:main Apr 14, 2025
11 checks passed
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 73.01%. Comparing base (4b7bca3) to head (88ff214).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/node/routes/domainProxy.ts 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@ Coverage Diff @@
## main #7284 +/- ##
==========================================
+ Coverage 72.94% 73.01% +0.07% 
==========================================
 Files 29 29 
 Lines 1785 1790 +5 
 Branches 380 383 +3 
==========================================
+ Hits 1302 1307 +5 
 Misses 408 408 
 Partials 75 75 
Files with missing lines Coverage Δ
src/node/cli.ts 90.90% <ø> (ø)
src/node/main.ts 49.10% <100.00%> (+0.92%) ⬆️
src/node/routes/pathProxy.ts 89.65% <100.00%> (+7.51%) ⬆️
src/node/routes/domainProxy.ts 47.27% <0.00%> (-1.79%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2c489d...88ff214. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@code-asher code-asher code-asher approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Proxy should allow OPTIONS

AltStyle によって変換されたページ (->オリジナル) /