Repository navigation
fix: [SDK-5330] reject null, empty, and NUL identity strings - #1522
Merged
Merged
Conversation
A blank or NUL external id was forwarded into login and stored. Log and return instead, matching the other client SDKs. Co-authored-by: Cursor <cursoragent@cursor.com>
The page bundle grew by 348 bytes and the service worker by 17 bytes. Co-authored-by: Cursor <cursoragent@cursor.com>
fadi-george
reviewed
Oct 7, 2026
fadi-george
requested changes
Oct 7, 2026
fadi-george
reviewed
Oct 7, 2026
addAlias was checking the string twice. Empty and NUL now fail inside validateStringLabel, which validateAliasLabel already calls. Co-authored-by: Cursor <cursoragent@cursor.com>
removeAliases and removeTags checked each entry themselves. The shared list helper already does that. Co-authored-by: Cursor <cursoragent@cursor.com>
sherwinski
reviewed
Oct 7, 2026
Contributor
There was a problem hiding this comment.
PR description — addAlias, removeAlias, addEmail, addSms, removeEmail, removeSms, addTag, and removeTag used to throw an empty-argument error for "". They now log and return. Please state the old behavior in the description so the change shows in the release notes.
fadi-george
force-pushed
the
ar/sdk-5330
branch
from
October 7, 2026 18:41
82059d8 to
952b6b4
Compare
nan-li
requested changes
Oct 7, 2026
fadi-george
force-pushed
the
ar/sdk-5330
branch
from
October 7, 2026 20:00
952b6b4 to
5ef7fbb
Compare
fadi-george
force-pushed
the
ar/sdk-5330
branch
2 times, most recently
from
October 7, 2026 20:04
6d20df9 to
aa8c7c7
Compare
Contributor
|
Updated the description with the old behavior under "Behavior changes". |
sherwinski
reviewed
Oct 7, 2026
Match Android: an empty language falls back to the browser language instead of being rejected. Moves getLanguage to a shared helper as getBrowserLanguage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
nan-li
approved these changes
Oct 7, 2026
fadi-george
approved these changes
Oct 7, 2026
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
1 Line Summary
Reject null, empty, and NUL identity strings in the website SDK before they are stored.
Details
Part of SDK-5327. Web has no native SDK underneath, so the guard lives here.
isMissinglogs and returns when a value is null,"", or contains a null byte. Whitespace is still allowed.initapp id. An empty app id still throws the existing invalid-app-id error. A null byte does too, since it fails the UUID check.login(externalId)addAlias/addAliases(label and id). Alias format checks are unchanged.removeAlias/removeAliasesaddEmail/removeEmailandaddSms/removeSmsaddTag/addTags(key only). An empty tag value is allowed, including one that contains a null byte. A null tag value is rejected.removeTag/removeTagstrackEvent(name)Wrong types still throw. One blank map or list entry rejects the whole call.
Behavior changes
addAlias,removeAlias,addEmail,addSms,removeEmail,removeSms,addTag, andremoveTagused to throw an empty-argument error for"". They now log and return.trackEventused to send any name unchecked. A non-string name now throws a wrong-type error, like the rest of the User API.removeTags: key is required.Systems Affected
Validation
Tests
Info
vp test(557 tests passed).vp check(0 errors, 5 pre-existing warnings in unrelated tests).Cases cover empty and NUL login, a kept whitespace login, empty tag values, a NUL tag key, and empty or NUL
setLanguage.Not run in a browser. The guards return before storage, and the unit tests assert that.
Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
No visual change.
Checklist
Related Tickets
https://linear.app/onesignal/issue/SDK-5330
Made with Cursor