Fix JWT encoding, null safety, and code quality issues#101
Closed
andrei-m-code wants to merge 2 commits intomasterfrom
Closed
Fix JWT encoding, null safety, and code quality issues#101andrei-m-code wants to merge 2 commits intomasterfrom
andrei-m-code wants to merge 2 commits intomasterfrom
Conversation
…is CI Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix Base64URL encoding in ApnSender and FirebaseSender (RFC 7617) - Fix potential NullReferenceException in ApnSender error handling - Fix static token cache key collision by including key ID - Add device token validation in ApnSender.SendAsync - Propagate CancellationToken in FirebaseSender.GetJwtTokenAsync - Remove infinite loop in CorePush.Tester - Remove unused System.IdentityModel.Tokens.Jwt dependency
8bfd614 to
cc5ac14
Compare
ef70ca9 to
6294c05
Compare
Owner
Author
|
Superseded by a more comprehensive PR that also removes BouncyCastle and upgrades to .NET 10 |
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.
Summary
ApnSenderandFirebaseSender— was using plain Base64 instead of URL-safe Base64 (RFC 7617: replace+→-,/→_, strip=padding). This could cause malformed JWTs and authentication failures with Apple/Google.ApnSendererror handling —Deserialize<ApnsError>(content).Reasonnow uses null-conditional operator to handle unexpected error formats from Apple.P8PrivateKeyIdso multipleApnSenderinstances with the same bundle ID but different credentials don't share tokens.ApnSender.SendAsync()— throwsArgumentExceptionon null/empty tokens instead of sending invalid requests to Apple.FirebaseSender.GetJwtTokenAsync()— the token was accepted bySendAsyncbut not passed to internal HTTP calls.CorePush.Testerand log the response.System.IdentityModel.Tokens.Jwtdependency fromCorePush.Tester.Test plan
dotnet build CorePush.sln)