Skip to content
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

Add CORS route to DevConsole #29342

Merged
merged 1 commit into from
Nov 24, 2022
Merged

Conversation

sberyozkin
Copy link
Member

No description provided.

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 17, 2022

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)

This message is automatically generated by a bot.

@sberyozkin
Copy link
Member Author

Hi @gsmet Not sure about the bot message, it starts with Add ...

@quarkus-bot

This comment has been minimized.

@sberyozkin
Copy link
Member Author

@michalvavrik Hi Michal, looks like io.quarkus.resteasy.test.security.HttpPolicyAuthFailureExceptionMapperTest.testAuthFailedExceptionMapper failure on Win might suggest there is some race condition there, please investigate when you'll have some time

@michalvavrik
Copy link
Member

@michalvavrik Hi Michal, looks like io.quarkus.resteasy.test.security.HttpPolicyAuthFailureExceptionMapperTest.testAuthFailedExceptionMapper failure on Win might suggest there is some race condition there, please investigate when you'll have some time

I'll check today and get back to you.

@michalvavrik
Copy link
Member

@michalvavrik Hi Michal, looks like io.quarkus.resteasy.test.security.HttpPolicyAuthFailureExceptionMapperTest.testAuthFailedExceptionMapper failure on Win might suggest there is some race condition there, please investigate when you'll have some time

I'll check today and get back to you.

I run your PR on Windows Server 2022 and could not reproduce it, I'll try investigate how could it theoretically happen, but please, if you ever see this failure again in another PR/CI, please let me know, thank you.

@michalvavrik
Copy link
Member

michalvavrik commented Nov 18, 2022

I run your PR on Windows Server 2022 and could not reproduce it, I'll try investigate how could it theoretically happen, but please, if you ever see this failure again in another PR/CI, please let me know, thank you.

Ah, I can explain it (with little guessing), will provide PR later today.

@sberyozkin sberyozkin force-pushed the devconsole_cors branch 3 times, most recently from 7821d4f to ebc646c Compare November 18, 2022 12:57
@sberyozkin
Copy link
Member Author

@stuartwdouglas I've added a dedicated Cors configuration group, for now it only has a single enabled property, but we can use this group to let users tune it, example, allow a dns lookup, etc

@quarkus-bot

This comment has been minimized.

@gsmet gsmet requested a review from phillip-kruger November 21, 2022 14:37
@pmlopes
Copy link
Contributor

pmlopes commented Nov 21, 2022

@sberyozkin @stuartwdouglas @cescoffier: be aware that Chrome behavior for localhost may not be what you expect:

https://bugs.chromium.org/p/chromium/issues/detail?id=67743

@sberyozkin
Copy link
Member Author

Hi @pmlopes

be aware that Chrome behavior for localhost may not be what you expect:
https://bugs.chromium.org/p/chromium/issues/detail?id=67743

Yeah, thanks, we touched upon some of the issues like that one; here though the DevConsole filter requires concrete Origin values, wildcard will not be returned

@quarkus-bot

This comment has been minimized.

Copy link
Member

@rsvoboda rsvoboda left a comment

Choose a reason for hiding this comment

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

I think this PR needs some changes.

HTTPS topic was covered in my previous comments, config update using DevUI on https is not working.

There are other issues I found:

127.0.0.1 use-case
Changing value using http://127.0.0.1:8080/api/q/dev/io.quarkus.quarkus-vertx-http/config triggers 2022-11-23 08:58:39,800 ERROR [io.qua.ver.htt.run.dev.DevConsoleCORSFilter] (vert.x-eventloop-thread-1) Only localhost origin is allowed, but Origin header value is: http://127.0.0.1:8080

hostname use-case
Changing value using http://rsvoboda-mac:8080/api/q/dev/io.quarkus.quarkus-vertx-http/config triggers 2022-11-23 09:45:31,871 ERROR [io.qua.ver.htt.run.dev.DevConsoleCORSFilter] (vert.x-eventloop-thread-0) Only localhost origin is allowed, but Origin header value is: http://rsvoboda-mac:8080

traceroute rsvoboda-mac                                                                                                                                               
traceroute to localhost (127.0.0.1), 64 hops max, 52 byte packets
 1  localhost (127.0.0.1)  0.611 ms  0.050 ms  0.040 ms

I think at least 127.0.0.1 use-case should be covered.
Hostname use-case could be handled later

@sberyozkin
Copy link
Member Author

sberyozkin commented Nov 23, 2022

@rsvoboda

I think at least 127.0.0.1 use-case should be covered.

Sure, fixed it.

Hostname use-case could be handled later

I agree, I'm not sure a DNS related check will have no side-effects on the overall DevUI experience. Local DevUI is meant to be used locally, and typing a fully qualified host name during the local work seems unnecessary.

But we have a new DevUI specific CORS group - so we can add a property there, allow-dns-reverse-lookup, which, if set to true will allow us check if the current DNS name resolves to localhost, we should probably do it later if you agree

@rsvoboda
Copy link
Member

@sberyozkin agree with the plan. I will try some experiments with this PR and provide feedback tmr morning

Copy link
Member

@rsvoboda rsvoboda left a comment

Choose a reason for hiding this comment

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

No further concerns with this PR

Checked items:

  • http vs. https

  • localhost use-case vs. 127.0.0.1 use-case vs. hostname use-case

  • /q/dev vs. customized /api/q/dev

  • OS: macOS, Windows

  • Browsers: Firefox, Vivaldi, Brave, Chrome, Edge, Safari

@sberyozkin
Copy link
Member Author

@rsvoboda

Browsers: Firefox, Vivaldi, Brave, Chrome, Edge, Safari

This is a proper testing :-), thanks

@sberyozkin sberyozkin merged commit 5fc0bd0 into quarkusio:main Nov 24, 2022
@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Nov 24, 2022
@sberyozkin sberyozkin deleted the devconsole_cors branch November 24, 2022 09:20
@cescoffier
Copy link
Member

Browsers: Firefox, Vivaldi, Brave, Chrome, Edge, Safari

And no Netscape?

@maxandersen
Copy link
Member

I'm missing Opera :)

@rsvoboda
Copy link
Member

No worries, I tried Opera too, just didn't list it :) Netscape ... hm, I would need to time travel back to Windows 98 times
Fun experiment was with iOS based Safari check using Web Inspector when I had my iOS device connected to Safari on my MBP machine.

@rsvoboda
Copy link
Member

Note to https check - the overall DevUI experience is affected by #29431, application.properties gets updated but the UI stays grey for the edited entry, the page needs to be reloaded.

@gsmet gsmet modified the milestones: 2.15 - main, 2.13.5.Final Nov 24, 2022
@gsmet gsmet modified the milestones: 2.13.5.Final, 2.7.7.Final Nov 24, 2022
@rsvoboda rsvoboda added the triage/qe? Issue could use a quality focused review to further harden it label Nov 28, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 28, 2022

/cc @mjurc, @rsvoboda

gsmet pushed a commit to gsmet/quarkus that referenced this pull request Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vertx triage/qe? Issue could use a quality focused review to further harden it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants