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

fix: Intercept redirection to /settings/clients/limit-exceeded page #955

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Sep 26, 2023

In some edge-case scenario, the app may incorrectly open a cozy-app even if the OAuth client limit is exceeded

This may happen if the cozy.oauthclients.max flag is not set when the app starts but it is set just after that. In that case, the limit check won't be done when the user tries to open a cozy-app because flags are not updated after the app start. This is an edge case of a8ad127

This may also happen if some network errors occur when querying the cozy-stack for doing the check. In that case the app will fallback to an "under the limit" scenario

In those cases, the app will tries to open the cozy-app and then the cozy-stack will return a 302 to /settings/clients/limit-exceeded

With current implementation, this 302 will be intercepted by the ReloadInterceptorWebView and redirected to an InAppBrowser instead of the OauthClientsLimitExceeded popup

Note that this happens only if app is served by the cozy-stack and not by the HttpServer

To prevent this we want to detect this scenario in the ReloadInterceptorWebView and open the OauthClientsLimitExceeded popup

In some edge-case scenario, the app may incorrectly open a cozy-app
even if the OAuth client limit is exceeded

This may happen if the `cozy.oauthclients.max` flag is not set when the
app starts but it is set just after that. In that case, the limit check
won't be done when the user tries to open a cozy-app because flags are
not updated after the app start. This is an edge case of
a8ad127

This may also happen if some network errors occur when querying the
cozy-stack for doing the check. In that case the app will fallback to
an "under the limit" scenario

In those cases, the app will tries to open the cozy-app and then the
cozy-stack will return a `302` to `/settings/clients/limit-exceeded`

With current implementation, this `302` will be intercepted by the
`ReloadInterceptorWebView` and redirected to an InAppBrowser instead of
the `OauthClientsLimitExceeded` popup

Note that this happens only if app is served by the cozy-stack and not
by the HttpServer

To prevent this we want to detect this scenario in the
`ReloadInterceptorWebView` and open the `OauthClientsLimitExceeded`
popup
@Ldoppea Ldoppea merged commit 7b059e7 into master Sep 27, 2023
1 check passed
@Ldoppea Ldoppea deleted the fix/oauth_client_limit_flag branch September 27, 2023 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants