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

Avoid the need for read:hub scope #35

Merged

Conversation

consideRatio
Copy link
Member

By using /hub/api that returns a json-blob with a single version field
that we need, we don't require the read:hub scope for access to the
/hub/api/info endpoint that provides the hub version and more.

By using /hub/api that returns a json-blob with a single version field
that we need, we don't require the `read:hub` scope for access to the
/hub/api/info endpoint that provides the hub version and more.
@consideRatio consideRatio requested a review from minrk October 14, 2021 11:46
Comment on lines -166 to +167
info = json.loads(resp.body.decode("utf8", "replace"))
state_filter = V(info["version"]) >= STATE_FILTER_MIN_VERSION
resp_model = json.loads(resp.body.decode("utf8", "replace"))
state_filter = V(resp_model["version"]) >= STATE_FILTER_MIN_VERSION
Copy link
Member Author

Choose a reason for hiding this comment

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

I saw resp_model was used elsewhere as a naming convention, so I liked the idea of changing this variable name from being named info after switching the endpoint from /info to /.

resp = await fetch(HTTPRequest(url=url + "/info", headers=auth_header))
resp = await fetch(HTTPRequest(url=url + "/", headers=auth_header))
Copy link
Member Author

Choose a reason for hiding this comment

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

I've verified that the / endpoint of the api returns a json object with a version key at least in jupyterhub 1.4.2, but I've not tested this code manually.

I opened #36 regarding this repo's lack of tests.

Copy link
Member Author

@consideRatio consideRatio Oct 14, 2021

Choose a reason for hiding this comment

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

I know I could in theory remove the auth header for this request, but I figure it makes sense that all requests no matter what passes the provided token for logging purposes in the hub pod etc anyhow.

@consideRatio consideRatio added the bug Something isn't working label Oct 14, 2021
@minrk minrk added enhancement New feature or request and removed bug Something isn't working labels Oct 14, 2021
@minrk minrk merged commit e446f5e into jupyterhub:master Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants