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

[Bug]: Catch OAuth login failures before extracting code and state #3257

Open
Brutus5000 opened this issue Oct 24, 2024 · 1 comment · May be fixed by #3266
Open

[Bug]: Catch OAuth login failures before extracting code and state #3257

Brutus5000 opened this issue Oct 24, 2024 · 1 comment · May be fixed by #3266
Labels

Comments

@Brutus5000
Copy link
Member

Describe the Bug

A common issue during login an exception due to failing regex parsing the OAuth redirect from Ory Hydra

Log file or Error Message

Client Version: 2024.8.0
java.lang.IllegalStateException: Could not extract value with pattern 'code=([^ &]+)' from: GET /?error=request_forbidden&error_description=The+request+is+not+allowed.+No+CSRF+value+available+in+the+session+cookie.&state=6NPKAdf1l6gJAUOkFOiWY2ruTnEHrZyUqLEaatbXDjeQzpTAZofpQF9opJnPw04WYYmh7cWu8FvKSsg4ocxObMubbV38Kr HTTP/1.1
at com.faforever.client.login.OAuthValuesReceiver.extractValue(OAuthValuesReceiver.java:145)
at com.faforever.client.login.OAuthValuesReceiver.readValues(OAuthValuesReceiver.java:137)
at com.faforever.client.login.OAuthValuesReceiver.readValues(OAuthValuesReceiver.java:92)
at com.faforever.client.login.OAuthValuesReceiver.lambda$receiveValues$0(OAuthValuesReceiver.java:53)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

Reproduce the bug

To reproduce most probably, either delete the CSRF cookie or wait until the CSRF token in login screens times out. (Haven't tested it).

Expected Behavior

From the redirect url it is obvious that there is an error key in the request parameters. In that case fail early and show a different/more useful error to the user.

Screenshots

No response

Additional context

No response

Which Operating System are you using?

Linux

@Brutus5000 Brutus5000 added the bug label Oct 24, 2024
@obydog002
Copy link
Contributor

An easy way to reproduce this is to clear browser cookies on the Authorize browser page, attempt to authorize, click the error popup that appears, then authorize again. the FAF client will throw the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants