fix(providers): keep refresh credential handles stable - #2780
Conversation
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
E2E Test AttestationLocal E2E tests passed. CI does not currently run this Podman scenario, so this comment serves as the verification record.
Test SummaryTests Executed
The test uses a fake issuer that invalidates each old access token. A single long-running workload succeeds initially, survives 12 token rotations with its original environment, and then fails closed after explicit refresh reconfiguration; a newly executed process succeeds with the replacement handle. |
|
/ok to test a505e8d |
|
Label |
| record, | ||
| key, | ||
| endpoints, | ||
| refresh_epochs.get(key).map(String::as_str), |
There was a problem hiding this comment.
A running process can keep using its old credential handle after an administrator manually replaces a refresh-managed credential. Because the handle does not change here, that process immediately gains access to the replacement credential, which could belong to a different account or authorization.
Please prevent normal provider updates from changing or deleting credentials owned by active refresh configuration, including related output credentials. Those values should be changed through refresh rotate/reconfigure/delete instead. Alternatively, changing them must also create a new handle. Add a test confirming that an old handle cannot access a manually replaced credential.
Replaced with a focused inline review comment.
Summary
Keep gateway-managed refresh credentials usable by long-running sandbox processes when their short-lived access tokens rotate. Workloads now receive an opaque, identity-stable handle whose resolver value advances to the current token, while explicit refresh reconfiguration and authorization-boundary changes revoke the old handle.
Related Issue
Closes #2777
Changes
Deviations from Plan
None — implemented as planned.
Testing
mise run pre-commitpassesmise run testpassesmise run cipassescargo test -p openshell-corepassescargo test -p openshell-serverpassescargo test -p openshell-supervisor-networkpassesprovider_refresh_handlespasses through 12 token rotations and verifies explicit reconfiguration revocationTests added:
e2e/rust/tests/provider_refresh_handles.rscovers a long-running Podman process through 12 rotations and a reauthorization boundary.Checklist
Documentation updated:
architecture/sandbox.md: stable handle data flow and revocation invariants.docs/sandboxes/providers-v2.mdx: workload behavior, authorization epochs, and rollout guidance..agents/skills/openshell-cli/SKILL.md: refresh lifecycle guidance for CLI workflows.