Skip to content

fix: [SDK-5332] reject blank identity strings - #1186

Open
abdulraqeeb33 wants to merge 2 commits into
mainfrom
ar/sdk-5332
Open

abdulraqeeb33 wants to merge 2 commits into
mainfrom
ar/sdk-5332

Conversation

@abdulraqeeb33

@abdulraqeeb33 abdulraqeeb33 commented Sep 22, 2026 •

Copy link
Copy Markdown

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

rejectNullOrEmpty in lib/src/utils.dart rejects null and empty for:

  • initialize(appId)
  • login(externalId)
  • addAlias / addAliases (label and id)
  • removeAlias / removeAliases
  • addEmail / removeEmail
  • addSms / removeSms
  • addTag / addTags (key only). An empty tag value is allowed. A null tag value is rejected.
  • removeTag / removeTags
  • addTrigger / addTriggers (key only). An empty trigger value is allowed.
  • removeTrigger / removeTriggers
  • trackEvent(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-null String, so null cannot reach this method.

Testing

Unit testing

flutter test for onesignalflutter_test.dart and user_test.dart passed, including login("") leaving the channel external id unset. flutter analyze lib test reported 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

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

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>
@abdulraqeeb33
abdulraqeeb33 requested a review from a team as a code owner September 22, 2026 20:42
Comment thread lib/src/user.dart Outdated
Empty language is the only reset path, so the blank-string guard was a breaking change.

Co-authored-by: Cursor <cursoragent@cursor.com>
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