Skip to content

feat: guard the primary mobile key against the secondary keys - #518

Closed
abelonogov-ld wants to merge 1 commit into
v11from
andrey/mobile-key-uniqueness
Closed

feat: guard the primary mobile key against the secondary keys#518
abelonogov-ld wants to merge 1 commit into
v11from
andrey/mobile-key-uniqueness

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

setSecondaryMobileKeys rejects a key the primary environment already uses, but the primary key could then be assigned to one of those keys afterwards, reaching a state neither call would have accepted. Setting it now goes through setMobileKey, which makes the same check the other way around, so the order the two are called in no longer decides whether the configuration is validated.

The property stays settable within the SDK, which assigns it on a copy of the config for each environment it starts.

BREAKING CHANGE: LDConfig.mobileKey is read-only outside the SDK. Assignments to it become calls to the throwing setMobileKey.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Provide links to any issues in this repository or elsewhere relating to this pull request.

Describe the solution you've provided

Provide a clear and concise description of what you expect to happen.

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the pull request here.


Note

Overview
Closes a validation gap where setSecondaryMobileKeys rejected a primary key collision, but assigning the primary key afterward could still create the same invalid config.

LDConfig.mobileKey is now public internal(set), with a new throwing setMobileKey(_:) that rejects keys already used by a secondary environment. The Objective-C wrapper mirrors this. The SDK still assigns mobileKey directly on per-environment config copies during startup.

Breaking change: external assignments to mobileKey must become try setMobileKey(...).

Reviewed by Cursor Bugbot for commit 0008e58. Bugbot is set up for automated code reviews on this repo. Configure here.

setSecondaryMobileKeys rejects a key the primary environment already
uses, but the primary key could then be assigned to one of those keys
afterwards, reaching a state neither call would have accepted. Setting
it now goes through setMobileKey, which makes the same check the other
way around, so the order the two are called in no longer decides
whether the configuration is validated.

The property stays settable within the SDK, which assigns it on a copy
of the config for each environment it starts.

BREAKING CHANGE: LDConfig.mobileKey is read-only outside the SDK.
Assignments to it become calls to the throwing setMobileKey.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld requested a review from a team as a code owner August 11, 2026 21:30
@abelonogov-ld
abelonogov-ld deleted the andrey/mobile-key-uniqueness branch August 11, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant