Skip to content

Startup should attempt refresh-token recovery before FATALing on a stale identity #321

Description

@moreWax

Startup should attempt refresh-token recovery before FATALing on a stale identity

Symptom: after the control plane rotates its signing key, sam-node run dies at startup:

loaded identity fails role requirement "sam:role:node": biscuit: invalid signature

Root cause: Start() verifies the stored biscuit against the freshly synced mesh config (the node's own SyncMeshConfig pulls the new CP pubkey at startup) and hard-fails on mismatch — without attempting any recovery. Yet the store usually holds everything needed to heal: refresh_token, oidc_issuer, oidc_client_id (device flow saves them), and renewWithRefreshToken + enroll --jwt-path already exist. The renewal loop only helps before expiry/rotation and only after a successful start; the startup path has no recovery rung at all.

Request: on role-requirement failure at startup, attempt silent re-enrollment via the stored refresh token (refresh grant → /enroll with the new JWT, keeping the PeerID) before FATALing; fall back to the reset+device-flow guidance only when the refresh token is absent or rejected. We implemented this client-side in our wrapper (OIDC discovery → refresh grant → sam-node resetrun --join --jwt-path) and it heals a rotated identity with zero human steps — it would be better upstream where everyone gets it.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions