Repository navigation
fix: Prevent flags in a persistent store from becoming available to mobile keys - #275
Merged
Merged
Conversation
…istent store FeatureFlag did not model clientSideAvailability, so the SDK dropped the object when it wrote a flag to Redis, Consul or DynamoDB. A Go SDK or the Relay Proxy then read usingMobileKey as true for that flag. FeatureFlag now keeps the object if the JSON has it. When the object is present, clientSide takes the value of usingEnvironmentId, as in the Go SDK, and the SDK writes the object with both properties. A flag without the object keeps its current encoding and behavior. Generated-by: termag
There was a problem hiding this comment.
Automated risk review (dry run): Medium
This PR would not be automatically approved. Human approval required.
Why: The change in DataModel.java preserves clientSideAvailability on flags written to persistent stores, which is an authorization-related control over mobile-key availability, so this cannot be Low despite the added serialization tests. Human review is needed and no reviewers were assigned.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
kinyoklion
approved these changes
Nov 19, 2026
kinyoklion
pushed a commit
that referenced
this pull request
Nov 20, 2026
🤖 I have created a release *beep* *boop* --- ## [7.18.2](launchdarkly-java-server-sdk-7.18.1...launchdarkly-java-server-sdk-7.18.2) (2026-11-20) ### Bug Fixes * Clear empty FDv2 selectors in shared protocol handling ([#261](#261)) ([576b081](576b081)) * Prevent flags in a persistent store from becoming available to mobile keys ([#275](#275)) ([32c8676](32c8676)) * Treat a null optional property in flag data as omitted ([#268](#268)) ([3af465d](3af465d)) * Update launchdarkly-java-sdk-internal to 1.13.0 ([#272](#272)) ([9cc5885](9cc5885)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > This **release PR** bumps the LaunchDarkly Java server SDK from **7.18.1** to **7.18.2** across Release Please metadata (`gradle.properties`, `Version.SDK_VERSION`, and `.release-please-manifest.json`). > > The new **CHANGELOG** section records the fixes shipped in this patch: clearing empty FDv2 selectors in shared protocol handling, blocking persistent-store flags from being exposed to mobile keys, treating null optional flag properties as omitted, and updating `launchdarkly-java-sdk-internal` to 1.13.0. Those behavioral changes are not part of this diff—only the version and release notes are updated here. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9087581. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.


Summary
FeatureFlagdid not modelclientSideAvailability, so the SDK dropped the object when it wrote a flag to Redis, Consul or DynamoDB. A reader of the store that uses the object, such as the Go SDK or the Relay Proxy, then treats the flag with the older rule and makes it available to mobile keys, even when the flag saysusingMobileKey: false.FeatureFlagnow keeps the object when the flag JSON has it, and the SDK writes it back with both properties. A property missing from the object reads as false. When the object is present,clientSidetakes the value ofusingEnvironmentId, as in the Go SDK. A flag without the object keeps its current encoding and behavior.The
clientSidevalue is set when the flag is read, so serialization still uses the existing adapter with no extra cost.The new
persistent data store/<store>/client-side availabilitytests in the test harness (launchdarkly/sdk-test-harness#657 for v3, launchdarkly/sdk-test-harness#658 for v2) pass with this change on Redis, Consul and DynamoDB, and fail without it.Opened from termag
Note
Overview
Fixes loss of
clientSideAvailabilitywhen the Java server SDK serializes feature flags to persistent data stores, which could make flags incorrectly available to mobile clients.FeatureFlagnow models optionalClientSideAvailability(usingMobileKey,usingEnvironmentId). On deserialize, if that object is present,clientSideis derived fromusingEnvironmentId(matching Go SDK behavior) and both fields are written back on serialize. Missing object properties default to false; flags without the object keep legacyclientSide-only JSON.ModelBuildersgainsclientSideAvailability(...); tests cover round-trip serialization and constructor updates.Reviewed by Cursor Bugbot for commit 6a96a06. Bugbot is set up for automated code reviews on this repo. Configure here.