Repository navigation
Fall back to the public URL when a Google login fails to refresh (0.10.1) - #17
Merged
Merged
Conversation
…0.1) An expired gcloud login is refused at the token endpoint with HTTP 400 invalid_grant, which tensorstore reports as neither PERMISSION_DENIED nor UNAUTHENTICATED, so a gs:// open raised instead of reading a public bucket through its https URL. An error from getting the access token (tensorstore's internal/oauth2/ code among its source locations) now counts as a refusal and ends the probe reads at once; when every way in fails after a refusal, the error raised carries the first refusal as its cause. Found by cellmap-flow on David's Mac. Claude-Session: https://claude.ai/code/session_0141wgF8mkGbjGfBFKfKhp64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
gs://open with a stale Google login now falls back to the bucket's public https URL, askvstore_specsintends for credentials that exist but don't work.cellmap-flow found this on David's Mac.
cellmap_flow view -d precomputed://gs://neuroglancer-janelia-flyem-hemibrain/emdata/clahe_yz/jpegraised, although the public https form of that volume opens fine. Hisapplication_default_credentials.jsonhad expired under the Workspace reauth policy, and Google refuses such a refresh with HTTP 400invalid_grant. tensorstore reports that asUnknown [HTTP code 400] ...(0.1.78:Bad Request [http_response_code='400'] ...).is_refusedonly matchedPERMISSION_DENIEDandUNAUTHENTICATED, sowith_accessraised instead of trying the next way. A 401 from the token endpoint (a bad client secret) already fell back, because tensorstore reports it asPERMISSION_DENIED.Changes, in
store.py:login_failed(error)is true when tensorstore names itsinternal/oauth2/code among the error's source locations, which is to say the error came from getting the access token. It covers a stale login, a rejected client, and a token endpoint out of reach.is_refusednow counts these. The message shapes on tensorstore 0.1.68, 0.1.78 and David's Mac build all carry that source location._read_keysandread_many) treat a failed login as an answer to no key. The other keys' reads are cancelled and the next way is tried at once. A failed login is never read as "missing", which the listing-off-bucket rule allows for a plain 403.with_access: when the last way fails too, after a refusal, its error carries the first refusal as__cause__. For a private bucket with a stale login, the raised error is the public URL's 403, and the traceback still shows theinvalid_grantabove it.Not changed: retries. A token endpoint out of reach (
UNAVAILABLE) is still retried underRetrybefore the fallback, as any transient error is. A 400 is not transient and moves on at once.Tests (
tests/test_access.py):is_refusedon the 400 and on an unreachable token endpoint, and not on a plain 400. It also checks the fallback and the chained cause with a fake attempt.openssl(tensorstore trusts it throughTENSORSTORE_CA_BUNDLE) and answers every token refresh 400invalid_grant. A local http server is the public URL (TENSORSTORE_GCS_HTTP_URL), and a subprocess with anauthorized_userlogin opensgs://bucket/vol.zarr/s0and reads it. The test is skipped whereopensslis missing.This is a patch release (0.10.1) under the spec's §8 rule, since it reads where 0.10.0 raised. There's no placement change, no unit table change, and no default change. The spec (Conventions 5 and its test line) and the CHANGELOG are updated. The changelog entry is marked unreleased until it's dated at release.
https://claude.ai/code/session_0141wgF8mkGbjGfBFKfKhp64