Skip to content

chore: [SDK-5282] keep the JWT out of the log pipeline - #1747

Open
nan-li wants to merge 1 commit into
5.8-mainfrom
nan/sdk-5282
Open

nan-li wants to merge 1 commit into
5.8-mainfrom
nan/sdk-5282

Conversation

@nan-li

@nan-li nan-li commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Redact the JWT from SDK logs. SDK-5282.

Details

Motivation

Two verbose log lines printed the token in full: the updateUserJwt entry line, and the HTTP client's header lines for signed requests. Log entries reach app log listeners and remote logging regardless of the console log level.

Scope

  • updateUserJwt logs the external ID and the last 8 characters of the token, matching Android.
  • OneSignalClient masks the Authorization header value as <redacted> in its request and response log lines. Other headers unchanged.
  • Nothing sent to the server changes.

Testing

Unit testing

Three log-listener tests assert no entry contains the token: updateUserJwt, and the client's request and response lines for a signed request. The client's private log methods are exposed to the Core tests through a category in the bridging header. All three fail without the fix.

Manual testing

Full unit test plan run locally on an iPhone 17 Pro simulator. Not run on a device.

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

🤖 Generated with Claude Code

@nan-li nan-li changed the title fix: [SDK-5282] keep the JWT out of the log pipeline chore: [SDK-5282] keep the JWT out of the log pipeline Sep 18, 2026
`updateUserJwt` logged the full token at verbose behind a TODO to remove it
before shipping, and `OneSignalClient` printed a request's `additionalHeaders`
on send and again in the response handler, which is where `OSRequestAuth`
puts the Authorization header, so every signed request logged its bearer.
`onesignal_Log` hands every entry to app listeners and the internal sink
whatever the console level is, so a host listener or remote logging could
see the token without anyone turning verbose on.

`updateUserJwt` now logs the external ID and the token's last 8 characters,
the breadcrumb Android keeps: it cannot be replayed, and it ties a supplied
token to a later rejection. The client masks the Authorization value as
`<redacted>` at both log sites and keeps the key, so a log still shows
whether a request went out signed.

Three listener tests pin it: the exact `updateUserJwt` entry, and the
client's request and response lines for a signed request, each asserting no
entry contains the token. The client's two private log sites are reachable
from the Core tests through a category, so no network round trip is needed.
All three fail against the previous source.
@nan-li
nan-li marked this pull request as ready for review September 18, 2026 01:24
@nan-li
nan-li changed the base branch from 5.7-main to 5.7-main-temp September 18, 2026 16:40
@nan-li
nan-li changed the base branch from 5.7-main-temp to 5.8-main September 18, 2026 16:44
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.

1 participant