Skip to content

Signing: inject ClockType to ensure hardcoded signatures don't fail when intermediate key expires#2771

Merged
NachoSoto merged 2 commits into
mainfrom
nacho/signature-inject-clock
Jul 10, 2023
Merged

Signing: inject ClockType to ensure hardcoded signatures don't fail when intermediate key expires#2771
NachoSoto merged 2 commits into
mainfrom
nacho/signature-inject-clock

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

Thanks to @aboedo for catching this and providing this simple idea.

…il when intermediate key expires

Thanks to @aboedo for catching this and providing this simple idea.
@NachoSoto NachoSoto added the test label Jul 7, 2023
@NachoSoto NachoSoto requested a review from a team July 7, 2023 22:36

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FWIW, What I did was adding a day very far into the future (Year 2106) in Android for the unit tests. But this also works 👍

Comment thread Sources/Security/Signing.swift
@aboedo

aboedo commented Jul 10, 2023

Copy link
Copy Markdown
Member

FWIW, What I did was adding a day very far into the future (Year 2106) in Android for the unit tests. But this also works 👍

Some poor dev is going to really hate you in 2107 :trollface:

@NachoSoto NachoSoto enabled auto-merge (squash) July 10, 2023 15:18
@codecov

codecov Bot commented Jul 10, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2771 (8e9a2da) into main (a505f04) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 8e9a2da differs from pull request most recent head b7930c3. Consider uploading reports for the commit b7930c3 to get more accurate results

@@            Coverage Diff             @@
##             main    #2771      +/-   ##
==========================================
- Coverage   86.49%   86.49%   -0.01%     
==========================================
  Files         214      214              
  Lines       15376    15379       +3     
==========================================
+ Hits        13300    13302       +2     
- Misses       2076     2077       +1     
Impacted Files Coverage Δ
Sources/Security/Signing.swift 91.19% <100.00%> (+0.13%) ⬆️

... and 1 file with indirect coverage changes

@NachoSoto NachoSoto merged commit 007f875 into main Jul 10, 2023
@NachoSoto NachoSoto deleted the nacho/signature-inject-clock branch July 10, 2023 15:30
This was referenced Jul 11, 2023
NachoSoto added a commit that referenced this pull request Jul 11, 2023
**This is an automatic release.**

### New Features
* `Trusted Entitlements`: (#2621) via NachoSoto (@NachoSoto)

This new feature prevents MitM attacks between the SDK and the
RevenueCat server.
With verification enabled, the SDK ensures that the response created by
the server was not modified by a third-party, and the entitlements
received are exactly what was sent.
This is 100% opt-in. `EntitlementInfos` have a new `VerificationResult`
property, which will indicate the validity of the responses when this
feature is enabled.

```swift
let purchases = Purchases.configure(
  with: Configuration
    .builder(withAPIKey: "")
    .with(entitlementVerificationMode: .informational)
)
let customerInfo = try await purchases.customerInfo()
if !customerInfo.entitlements.verification.isVerified {
  print("Entitlements could not be verified")
}
```

You can learn more from [the
documentation](https://www.revenuecat.com/docs/trusted-entitlements).

### Other Changes
* `TrustedEntitlements`: new `VerificationResult.isVerified` (#2788) via
NachoSoto (@NachoSoto)
* `Refactor`: extracted `Collection.subscript(safe:)` (#2779) via
NachoSoto (@NachoSoto)
* `Trusted Entitlements`: added link to docs in
`ErrorCode.signatureVerificationFailed` (#2783) via NachoSoto
(@NachoSoto)
* `Trusted Entitlements`: improved documentation (#2782) via NachoSoto
(@NachoSoto)
* `Tests`: fixed flaky failure with asynchronous check (#2777) via
NachoSoto (@NachoSoto)
* `Integration Tests`: re-enable signature verification tests (#2744)
via NachoSoto (@NachoSoto)
* `CI`: remove `Jazzy` (#2775) via NachoSoto (@NachoSoto)
* `Signing`: inject `ClockType` to ensure hardcoded signatures don't
fail when intermediate key expires (#2771) via NachoSoto (@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
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.

3 participants