Skip to content

feat: add support for secure mode to react native sdk#1228

Open
appsandwich wants to merge 2 commits intolaunchdarkly:mainfrom
appsandwich:vc/mobile-secure-mode
Open

feat: add support for secure mode to react native sdk#1228
appsandwich wants to merge 2 commits intolaunchdarkly:mainfrom
appsandwich:vc/mobile-secure-mode

Conversation

@appsandwich
Copy link
Copy Markdown

@appsandwich appsandwich commented Mar 26, 2026

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

N/A

Describe the solution you've provided

This PR adds support for the secure mode hash in the React Native SDK. It passes the new hash property on the LDIdentifyOptions object into MobileDataManager, which is then propagated into the call to makeRequestor (where the existing secureModeHash parameter is available).

Describe alternatives you've considered

N/A

Additional context

N/A


Note

Low Risk
Low risk: limited to threading an optional hash from identify into request construction, plus tests and a type-doc update; primary risk is incorrect query param propagation affecting flag fetch URLs.

Overview
Adds secure mode support to the React Native SDK by capturing LDIdentifyOptions.hash during MobileDataManager.identify() and passing it into makeRequestor, which appends it as the h query parameter on polling/streaming requests.

Updates LDIdentifyOptions to document the new optional hash field, and adds React Native MobileDataManager tests verifying h= is included when provided, omitted when absent, persisted across connection mode changes, and cleared by a subsequent identify without a hash.

Written by Cursor Bugbot for commit 5be28bd. This will update automatically on new commits. Configure here.

@appsandwich appsandwich requested a review from a team as a code owner March 26, 2026 17:31
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

this.context = context;

// Capture the secure mode hash (if set), so that it can be forwarded to makeRequestor on each re(connection).
this.secureModeHash = identifyOptions?.hash;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secure mode hash missing from streaming connection URL

High Severity

The secureModeHash is only passed to makeRequestor (used for polling), but not propagated to the streaming connection. The browser SDK's BrowserDataManager additionally calls this.setConnectionParams({ queryParameters: [{ key: 'h', value: hash }] }) which feeds into createStreamingProcessor via _connectionParams.queryParameters. Without this call, the StreamingProcessor constructs its URI without the h= query parameter, so secure mode verification fails for streaming connections.

Additional Locations (1)
Fix in Cursor Fix in Web

@joker23
Copy link
Copy Markdown
Contributor

joker23 commented Mar 26, 2026

Hey @appsandwich - thanks for the contribution; however, per our secure mode docs, this feature is not supported in the React Native SDK.

The main gap here is actually on the LaunchDarkly server as it will not do anything with the hash url param when that request is received. Internally, we do have a few work items discussing how we can enable the benefits of secure mode to all of our SDKs, but I don't think we have any concrete plans to share today.

If no questions or concerns - we will close this PR as it is not a feature we can support at the moment.

Thanks!

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.

2 participants