Skip to content

Conversation

@bbirman
Copy link
Member

@bbirman bbirman commented Sep 26, 2025

No description provided.


CFRelease(privateKeyRef);
if (decryptedData == nil) {
if (decryptedData == nil || [decryptedData length] != 32) {
Copy link
Member Author

@bbirman bbirman Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the comment in the flapping test (below), starting in 17.4 decrypting with a bad key returns data instead of nil so at the time I just changed our expected error in the test. But it looks like that data is also variable length (in my runs locally it was 72, 54, and 15). When the data length is less than 32, lines 209 or 210 crash so adding a length check before that

}
// As of 17.4, decrypting a bad key with PKCS1 returns data instead of nil, so the secret decryption doesn't fail
// at the same point as before but using it later to decrypt the content still fails
XCTAssert(nonRSASecretError.code == SFSDKPushNotificationErrorContentDecryptionFailed || nonRSASecretError.code == SFSDKPushNotificationErrorSecretDecryptionFailed);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the check for both errors in case there's a chance that the bad data is 32 long and passes the check but still fails to decrypt later

@codecov
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.48%. Comparing base (84223ca) to head (c817fa0).
⚠️ Report is 7 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3937      +/-   ##
==========================================
- Coverage   63.50%   63.48%   -0.02%     
==========================================
  Files         250      250              
  Lines       22501    22501              
==========================================
- Hits        14289    14285       -4     
- Misses       8212     8216       +4     
Components Coverage Δ
Analytics 70.78% <ø> (ø)
Common 70.58% <ø> (ø)
Core 53.94% <100.00%> (-0.03%) ⬇️
SmartStore 73.66% <ø> (ø)
MobileSync 87.66% <ø> (ø)
Files with missing lines Coverage Δ
...PushNotification/SFSDKPushNotificationDecryption.m 93.75% <100.00%> (+2.34%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bbirman bbirman merged commit 9b2585e into forcedotcom:dev Sep 30, 2025
21 of 24 checks passed
@bbirman bbirman deleted the flapper branch September 30, 2025 18:11
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