You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(auth): address review feedback on machine account key file
- Enforce 0700 perms on existing machine-accounts directory, not just
on first creation
- Use os.CreateTemp for atomic writes so concurrent logins for the
same machine account cannot race on the same .tmp filename
- Remove the on-disk PEM if the keyring write fails during login, so
failed logins don't leave crypto material behind
- Also remove the PEM from disk in the logout "user not found but
stray state" branch — this is the exact cleanup path users will
hit after a failed #146 login
- Use WrapUserErrorWithHint for the token refresh error paths to match
the surrounding style; acknowledge in the hint that the original
credentials file may no longer be available
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
returnnil, fmt.Errorf("failed to read machine account private key from %s: %w (try logging in again with 'datumctl auth login --credentials')", ma.PrivateKeyPath, readErr)
206
+
returnnil, customerrors.WrapUserErrorWithHint(
207
+
"failed to read machine account private key from "+ma.PrivateKeyPath,
208
+
"re-run 'datumctl auth login --credentials <file>'; you may need to download a new machine account credentials file from the Datum portal if the original is no longer available",
209
+
readErr,
210
+
)
207
211
}
208
212
}
209
213
ifpemKey=="" {
210
-
returnnil, fmt.Errorf("machine account session is missing its private key; log in again with 'datumctl auth login --credentials'")
214
+
returnnil, customerrors.WrapUserErrorWithHint(
215
+
"machine account session is missing its private key",
216
+
"re-run 'datumctl auth login --credentials <file>'; you may need to download a new machine account credentials file from the Datum portal if the original is no longer available",
0 commit comments