-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Quarkus WebSockets Next does not respect @HttpAuthenticationMechanism #46013
Comments
That is true, however documentation https://quarkus.io/guides/security-authentication-mechanisms#use-annotations-to-enable-path-based-authentication-for-jakarta-rest-endpoints is clear: @vmutafov if we can settle that this is a feature request, I'll put it on my list and address it eventually :-). I think that "proposal" makes sense as we can detect this before HTTP upgrade checks are performed. |
Or if you want to contribute, just shout, I can give you few pointers. At any rate, I think you made a good point. |
This is not a first time I was thinking about build-time validation failures for unsupported features in the WS Next, but for permission checkers we decided to implement that instead and I think here it is also better to just start supporting this instead. |
Actually, I think I can take care of it rather quickly, I'll have a look tomorrow or next week. Cheers |
Thanks for your quick responses, @michalvavrik!
Yeah, it may be considered as a feature request. After reading the docs again, you are right that it's quite clear these annotations are for Jakarta REST but then again, the current behaviour was a bit unexpected (to me at least).
I'm also willing to help if I can |
got it
Yeah, we are really looking for contributors and are quite welcoming https://github.com/quarkusio/quarkus/issues?q=is%3Aissue%20state%3Aopen%20label%3Aarea%2Fsecurity :-) Just I have already opened 3 PRs in WebSockets Next that are waiting for a review and one of them is touching same classes, so I have solution for this, but it doesn't make sense to work on it till this gets unblocked. |
I ended-up doing it myself because I remembered it wrong, it was bit complex. #46161 should take care of it. Thanks for reporting this issue, I think it was a good point. |
Describe the bug
Hi! Please, correct me if I'm wrong, but it seems Quarkus WebSockets Next doesn't handle
@HttpAuthenticationMechanism
when declared on the web socket class like:As far as I understand how the
@HttpAuthenticationMechanism
annotation is handled in regular RestEasy endpoints, usages are recorded here and then theHttpAuthenticator
should use the declared auth mechanism.If there is no pre-selected auth mechanism, all registered auth mechanisms are iterated and requests are checked with every mechanism. In my opinion, this may lead to unexpected security problems if a websocket that should have used a dedicated auth mechanism, now may accept requests as long as they are authenticated by some other auth mechanism.
Expected behavior
The
@HttpAuthenticationMechanism
should either be supported or at least a build time exception should be thrown when it's declared on a websocket.Actual behavior
The
@HttpAuthenticationMechanism
annotation is not handled.How to Reproduce?
Output of
uname -a
orver
23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64
Output of
java -version
openjdk version "21" 2023-09-19 OpenJDK Runtime Environment (build 21+35-2513) OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
Quarkus version or git rev
3.17.7
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Additional information
No response
The text was updated successfully, but these errors were encountered: