Keep the credential as a versioned record written whole #60
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "credential-state"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plumb's home-and-state law wants machine-written records under
state/,schema-versioned, and written by writing beside and renaming. The credential
was none of those: two bare lines at the home root, truncated in place by
File::create, so a crash mid-write left half a token on disk and nothingcould tell an old shape from a corrupt one.
It is now
state/pat.jsoncarrying its schema, staged beside and renamed over,with the mode set before any bytes are written. An unknown schema declines to
load rather than guessing. Naming the record by kind leaves room for the OIDC
session to arrive as its own record rather than sharing one file with a
credential that never expires — a refresh would otherwise rewrite the
long-lived secret on every 401.
The act read the file straight off disk, so it moved with it and now asserts
the schema too. That is what caught the change.
plumb also moved to 0.18.9 while this repository's lock still resolved 0.18.7,
which held guard at its second step.
Guard was run in full on the committed state and is clean, including all six
acts.
One law is still owed here:
config::home()hand-rolls its cascade overENSIGN_HOME,XDG_CONFIG_HOMEand$HOMEinstead of going through Plumb's.That needs
crates/clito depend on Plumb and is left for its own change.