Repository navigation
Closed
Description
What happens
On the desktop app (built from main plus #1581, 2026-11-08), with an Earthdata Login token remembered on this computer:
- Start the app. Nothing has read the token yet: it is read lazily (
earthdata::restore). - Run a plugin command that calls
earthdata.statusand then fetches from Earthdata. In our case it was the BrasilData plugin's GEDI L4D command:earthdata.status, thenhost.fetchof a CMRgranules.jsonsearch, thenlayer.addUrlwithbboxon an ORNL DAAC COG. - The fetch fails with
https://cmr.earthdata.nasa.gov/search/granules.json?[query omitted]: request cancelled before it was sent. - Run the same command again: it works. The token was restored during the first run.
Why
- The snapshot: a node with a
Networkeffect bindsRuntimeAccounts::captureat plan time (policy/plan.rs,bind). That snapshot includesearthdata::account_identity(), the active in-memory token, which is stillNone. - The restore: inside the command,
earthdata.statuscallsearthdata::restore(). The remembered token becomes active (None→Some). - The cancel:
host.fetchruns understill = continuation.check().Node::current()then seesauth.is_current() == false("the active account changed"), andcheck_stillcancels the request.
The same holds for the first request to a data host inside a command, because earthdata::authorization() also calls restore(). A built-in command that reads an Earthdata COG first thing in a session probably cancels its own later requests in the same way. I have not checked that.
Since #1461 this is deliberate: remembered_tokens asserts "restoration changes active identity just like replacement". So the fix should not loosen the identity check. It should make sure the restore happens before a command takes its snapshot.
Choices in this proposal
- Read the remembered token off the frame at startup. The desktop app would do this as soon as it has a credential store, reusing
earthaccessui::restore, which already reads it on a thread. Commands started afterwards capture the restored identity.- Cost: one keychain read at launch, off the frame, the same read the Earthaccess pane does today when it is opened.
- The command line and Python already opt in to saved secrets explicitly, so they can keep reading lazily.
- Say why when a restore cancels a request. A command still running when that read lands is cancelled, as it should be under fix(security): bind approvals to exact execution scopes #1461. The message should then say what happened: "the Earthdata token remembered on this computer was read while this command ran; run it again". At the moment it says only "request cancelled before it was sent".
- Rejected: treat restoration as no account change. It is simpler, but it contradicts the rule fix(security): bind approvals to exact execution scopes #1461 states, and a maintainer should decide that, not this issue.
Workaround
Click the command a second time. The BrasilData plugin now says so when it sees this cancellation.
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(earthdata): the command line and Python read the remembered token…
fix(earthdata): read the remembered token only for a command that nam…
fix(earthdata): read the remembered token at launch (#1626) (#1707)