fix: [SDK-5332] reject blank identity strings - #1186
Open
abdulraqeeb33 wants to merge 2 commits into
Open
abdulraqeeb33 wants to merge 2 commits into
abdulraqeeb33 wants to merge 2 commits into
Conversation
Blank login, app id, language, alias, email, sms, tag key, trigger key, and custom event names were forwarded to native. One helper now drops those calls. Co-authored-by: Cursor <cursoragent@cursor.com>
fadi-george
reviewed
Sep 22, 2026
Empty language is the only reset path, so the blank-string guard was a breaking change. Co-authored-by: Cursor <cursoragent@cursor.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.
Description
One Line Summary
Reject null and empty identity strings through one shared helper.
Details
Motivation
Fixes SDK-5332.
Empty login was forwarded to the native channel. Null and empty are rejected together on the identity APIs below. Part of SDK-5327.
Scope
rejectNullOrEmptyinlib/src/utils.dartrejects null and empty for:initialize(appId)login(externalId)addAlias/addAliases(label and id)removeAlias/removeAliasesaddEmail/removeEmailaddSms/removeSmsaddTag/addTags(key only). An empty tag value is allowed. A null tag value is rejected.removeTag/removeTagsaddTrigger/addTriggers(key only). An empty trigger value is allowed.removeTrigger/removeTriggerstrackEvent(name)Whitespace is still allowed. Public method signatures are unchanged.
setLanguage("")is not rejected. It is the reset to the device language, and there is no other reset path. The Dart parameter is a non-nullString, so null cannot reach this method.Testing
Unit testing
flutter testforonesignalflutter_test.dartanduser_test.dartpassed, including login("") leaving the channel external id unset.flutter analyze lib testreported no issues.Manual testing
Not run. The guards return before the method channel call, and the unit tests assert the mock channel is not invoked.
Affected code checklist
Checklist
Overview
Testing
Final pass