fix: [SDK-5331] reject blank identity strings - #66
Open
abdulraqeeb33 wants to merge 4 commits into
Open
abdulraqeeb33 wants to merge 4 commits into
abdulraqeeb33 wants to merge 4 commits into
Conversation
Blank login, app id, language, alias, email, sms, tag key, trigger key, and custom event names were sent to the native plugin. One helper now drops those calls. Co-authored-by: Cursor <cursoragent@cursor.com>
Empty language is the only reset path. Null is still rejected. Co-authored-by: Cursor <cursoragent@cursor.com>
fadi-george
reviewed
Sep 25, 2026
| @@ -1,3 +1,26 @@ | |||
| export function rejectNullOrEmpty(value: unknown, api: string): boolean { | |||
Contributor
There was a problem hiding this comment.
Id rename to isMissing
Author
There was a problem hiding this comment.
Renamed to isMissing on this PR and the other SDK PRs.
fadi-george
reviewed
Sep 25, 2026
| return true; | ||
| } | ||
|
|
||
| export function rejectNullOrEmptyKeys( |
Contributor
There was a problem hiding this comment.
maybe rename to hasMissingEntries
Author
There was a problem hiding this comment.
Renamed to hasMissingEntries. The list helper is isMissingAny.
The checks read as predicates: isMissing, isMissingAny, and hasMissingEntries.
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-5331.
Null and empty strings were forwarded to the native plugin. Part of SDK-5327.
Scope
rejectNullOrEmptyandrejectNullOrEmptyKeysinsrc/helpers.tsreject 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. A null trigger value is rejected.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.nullis still rejected.Testing
Unit testing
vp test: 240 tests passed, coverage above the repo thresholds. Cases cover empty and null login, empty app id, empty tag keys, empty trigger keys, an allowed empty tag value, andsetLanguage("")still calling native.Manual testing
Not run. The guards return before the native call, and the unit tests assert the plugin is not called.
Affected code checklist
Checklist
Overview
Testing
Final pass