Conversation
Rename and name reuse looked up driver_secret:<display-name>, so a rotated refresh token could be dropped or attached to another account. Mint credential_owner on first save, key KV rows by that id, and migrate continuing name-keyed leftovers atomically. Forecast learning ignores the new field so an upgrade does not reset PV/load models. Refs #1109 Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1109.
Problem and result
Rotated OAuth secrets are stored as
driver_secret:<display-name>:<key>. A rename looks up the new name and falls back to the stale YAML token. Reusing the old name applies the leftover rotation to another account. That is the release-blocker found on v3.0.3-beta.1; it is still true on current master (552c864a).This draft mints a stable
credential_owneron first Settings save, keys KV rows asdriver_secret:<owner>:<key>, and migrates leftover name-keyed rows only when the same named driver continues. A reused name gets a new owner and does not inherit the old rotation. Ambiguous name-keyed and owner-keyed values for the same key are rejected. Config document and credential writes stay in oneSaveConfigurationtransaction.Related: community #1503 / draft #1507 fix myUplink Test connection (
#1502) by sharing the live name-keyed row with the probe. They do not fix this owner bug. After this lands, a later probe rotation must look upSecretOwner()(not the display name). Leftover name-keyed copies are not deleted, so #1507 still works until the next rotation.Scope and safety
credential_owneris bookkeeping, not a household setting. Settings GET/POST already round-trips the live document, so the UI keeps the id without a new field.credential_owner, so minting it on upgrade does not reset PV/load models.Verification
Covers rename, name reuse with a different account, explicit reauthorization, restart, first-import and Bind migration of name-keyed rows, ambiguous ownership, and the existing myUplink OAuth persist tests (now owner-keyed).
No real accounts. No hardware.
Checklist
What Fredrik needs to decide
SecretOwner(); otherwise a post-migration token rotation is invisible to the probe.