fix(config): migrate legacy auth and subscription config keys#3895
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(config): migrate legacy auth and subscription config keys#3895cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
The auth→mfa and flat subscription field refactors silently ignored existing config.json values, disabling TOTP and Pro subscription keys after upgrade. Restore backward-compatible unmarshaling and migrate legacy fields before environment loading allocates empty nested structs. Co-authored-by: Denis Gukov <fiftin@outlook.com>
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.
Bug and impact
Recent config refactors renamed
auth→mfaand moved flatsubscription_key*fields into asubscriptionblock. Existing deployments that had not updated theirconfig.jsonwould silently lose:totp.enabledwas never loaded.subscription_key/subscription_key_filewere ignored after upgrade.This is a security and licensing regression with a concrete trigger: upgrade to current
developwhile keeping an older config file.Root cause
JSON unmarshaling only binds the new field names.
loadConfigEnvironment()then allocates empty nested structs, masking the absence of migrated values.Fix
authand flatsubscription_*keys during config load.migrateLegacyConfig()after reading the config file and before environment/default loading.Config.SubscriptionwithensureSubscriptionConfig()before readingKeyFile.Validation
go test ./util/...andgo test ./services/project/...pass.