-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscription keychain sharing for access token #690
Conversation
// This migration is to prevent breaking internal tests and should be removed before launch | ||
do { | ||
if let newAccessToken = try accessTokenStorage.getAccessToken() { | ||
throw MigrationError.noMigrationNeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not breaking functionality but this throw
is caught down below and turned into throw MigrationError.migrationFailed
cb11e54
to
1eb0850
Compare
Rebased on main for latest changes. |
*/ | ||
enum AccountKeychainField: String, CaseIterable { | ||
case accessToken = "subscription.account.accessToken" | ||
case testString = "subscription.account.testString" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops!
@@ -34,15 +34,15 @@ public final class AppStoreRestoreFlow { | |||
case subscriptionExpired(accountDetails: RestoredAccountDetails) | |||
} | |||
|
|||
public static func restoreAccountFromPastPurchase() async -> Result<Void, AppStoreRestoreFlow.Error> { | |||
public static func restoreAccountFromPastPurchase(appGroup: String) async -> Result<Void, AppStoreRestoreFlow.Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@quanganhdo Spotted this discrepancy, the param probably should be subscriptionAppGroup
for consistency.
Task/Issue URL: https://app.asana.com/0/414235014887631/1206564116141608/f iOS PR: duckduckgo/iOS#2538 BSK PR: duckduckgo/BrowserServicesKit#690 **Optional**: Tech Design URL: https://app.asana.com/0/481882893211075/1206591576458107/f CC: @quanganhdo @diegoreymendez **Description**: For the macOS: Recheck entitlements and display error messaging for cancelled subscriptions we need to make sure the VPN is no longer usable once their entitlement to use it are withdrawn. In [iOS: Integrate with Subscription](https://app.asana.com/0/0/1204886111391114), we’re already checking the entitlements intermittently and on rekey, disabling the VPN*. To authenticate the VPN's register requests (to receive a server + keypair for the tunnel configuration), the PacketTunnelProvider (central component of the VPN extension) needs an access token which is to be provided by the Subscription library built in O-1. This can be pulled accessed directly from the library and, in the iOS and macOS AppStore case, shared between processes (the app, the VPN agent, the VPN extension) using a keychain group. We would like the fetching and lifecycle to be managed exclusively by the Subscription library. We will need to share / delete the subscription access token between processes, so this task covers: - Adding a new subscriptions app group - Injecting this app group into the subscriptions library to be used to create keychain entries. **Steps to test this PR**: 1. Make sure subscriptions flow still works (don’t attempt to connect VPN yet) 2. (Remaining steps in DEBUG only) Open the console and start logging 3. Connect to Network Protection. 4. After the macOS menu item has appeared, check the console and ensure there is a log saying "VPN Agent found token" --- ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f)
* main: Subscription keychain sharing for access token (#690)
* main: Changes to 114.1.0-1 hotfix branch (#706) Navigation: Improve same-document navigation handling (#702) Add pixels for our main VPN funnels (#698) Remove Autoconsent subfeature (#697) #URL macro (#657) Handle expired entitlement in NetP (#692) Remove isSubscriptionEnabled check when attempting to delete NetP token (#701) Remove CGNAT range. (#691) Subscription keychain sharing for access token (#690) Integrate confirm entitlements endpoint (#700) fix bundle name in breakByRaisingSigInt (#699) Adds support for deleting all logins (#672) Bump C-S-S to 5.2.0 (#695) Update xcode-version to 15.2. (#688) Bump Tests/BrowserServicesKitTests/Resources/privacy-reference-tests (#687)
Please review the release process for BrowserServicesKit here.
Required:
Task/Issue URL: https://app.asana.com/0/414235014887631/1206564116141608/f
iOS PR: duckduckgo/iOS#2538
macOS PR: duckduckgo/macos-browser#2292
What kind of version bump will this require?: Major
Optional:
Tech Design URL: https://app.asana.com/0/481882893211075/1206591576458107/f
CC: @quanganhdo @diegoreymendez
Description:
For the macOS: Recheck entitlements and display error messaging for cancelled subscriptions we need to make sure the VPN is no longer usable once their entitlement to use it are withdrawn. In iOS: Integrate with Subscription, we’re already checking the entitlements intermittently and on rekey, disabling the VPN*.
To authenticate the VPN's register requests (to receive a server + keypair for the tunnel configuration), the PacketTunnelProvider (central component of the VPN extension) needs an access token which is to be provided by the Subscription library built in O-1. This can be pulled accessed directly from the library and, in the iOS and macOS AppStore case, shared between processes (the app, the VPN agent, the VPN extension) using a keychain group. We would like the fetching and lifecycle to be managed exclusively by the Subscription library.
We will need to share / delete the subscription access token between processes, so this task covers:
Steps to test this PR:
Generally make sure subscriptions flow still works. But to test with migration of token for existing internal users:
OS Testing:
—
Internal references:
Software Engineering Expectations
Technical Design Template