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] - Do not show oauth screen for users accessing the main jhub-apps service #2570

Closed
krassowski opened this issue Jul 22, 2024 · 3 comments · Fixed by #2631
Closed

[BUG] - Do not show oauth screen for users accessing the main jhub-apps service #2570

krassowski opened this issue Jul 22, 2024 · 3 comments · Fixed by #2631

Comments

@krassowski
Copy link
Member

Describe the bug

In nebari (and often in JupyterHub in general) the auth sequence involves two or three OAuth providers:

  • JupyterHub OAuth provider, which calls
  • Keycloak OAuth provider, which (sometimes) calls
  • External third-party OAuth provider (e.g. Google or GitHub).

In such setups the JupyterHub OAuth provider is meant to be transparent to the users unless user grants additional permissions to third-party services. Typically JupyterHub OAuth checks the user identity when spawning servers, and verifies that user wants to share their identity (or specific permissions) with services.

Jhub-apps is a service which requires users to confirm that they agree to share the JupyterHub OAuth identity with the service. Currently, a confusing screen is shown to users when they first log-in into JupyterHub, after they already authenticated with Keycloak:

Screenshot from 2024-07-22 09-57-57

It is confusing because users do not know what "japps" (sic!) service is, nor what the default scope description ("Identify the owner of the requesting entity") mean, since a very technical language is used.

This screen is not always necessary, user servers are by default confirmed without user action, and services "blessed" by administrator of the JupyterHub are also handled transparently. This is configured by setting oauth_no_confirm in the service configuration.

Expected behavior

Since jhub-apps is tightly integrated with nebari it makes sense to exempt it from user making the explicit confirmation that they do want to share their identity with jhub-apps.

If we do want to keep this screen however, we may want to customize it to better describes which actions the service will perform on behalf of the user (like creating named servers, sharing servers, etc) as access to this actions is currently permitted via a separate token rather than through oauth scopes.

We previously had oauth_no_confirm set to True on some services used when jhub-apps is enabled. This got removed during JupyterHub 5 upgrade (#2427) due to JupyterHub now requiring additional URL configuration for it (jupyterhub/jupyterhub#4801). The removal was based on a conversation in which these services were described as applications that do not oauth with JupyterHub, but uses keycloak directly. This is correct, these services:

c.JupyterHub.services.extend(
[
service_for_jhub_apps(name="Argo", url="/argo"),
service_for_jhub_apps(name="Users", url="/auth/admin/nebari/console/"),
service_for_jhub_apps(name="Environments", url="/conda-store"),
service_for_jhub_apps(name="Monitoring", url="/monitoring"),
]
)

do not use JupyterHub oauth but they use Keycloak directly.

However, jhub-apps itself as of today:

  • does not have any references to keycloak (and is designed to work in nebari-agnostic environments)
  • uses JupyterHub as an oauth provider, see jhub_apps/service/security.py

The code change would need to be done in:

By passing a new oauth_no_confirm argument down to where the main jhub-app service is appended to c.JupyterHub.services in jhub-apps.

We should probably also rethink the name of the service, it is currently set to japps (here) which does not correspond to jhub-apps used in the documentation.

OS and architecture in which you are running Nebari

Irrelevant

How to Reproduce the problem?

  1. Deploy nebari with jhub_apps.enabled: false
  2. Create a new test user in keycloak
  3. Login to nebari as that test user
  4. See that everything is fine, logout
  5. Re-deploy nebari with jhub_apps.enabled: true
  6. Login to nebari as the test user again
  7. See the OAuth screen prompting for confirmation

Command output

No response

Versions and dependencies used.

No response

Compute environment

None

Integrations

No response

Anything else?

No response

@krassowski krassowski added type: bug 🐛 Something isn't working needs: triage 🚦 Someone needs to have a look at this issue and triage labels Jul 22, 2024
@krassowski
Copy link
Member Author

What do you think @aktech?

@aktech
Copy link
Member

aktech commented Jul 22, 2024

This is a good idea! thanks for the detailed issue.

@Adam-D-Lewis Adam-D-Lewis added area: integration/jhub-apps and removed needs: triage 🚦 Someone needs to have a look at this issue and triage labels Jul 23, 2024
@Adam-D-Lewis
Copy link
Member

I'm going through triaging issues today and saw this one. Looks like a nice improvement. I agree that that "japps" would be better as "jhub-apps".

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

Successfully merging a pull request may close this issue.

3 participants