Skip to content

Commit

Permalink
Update GSPaddle to prevent any connections to Paddle except for activ…
Browse files Browse the repository at this point in the history
…ation

[#169 state:fixed]
  • Loading branch information
lukele committed Sep 29, 2018
1 parent 35a18be commit e101d97
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 1 deletion.
Binary file not shown.
Expand Up @@ -17,3 +17,14 @@ FOUNDATION_EXPORT const unsigned char GSPaddleVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <GSPaddle/PublicHeader.h>
#import <Paddle/Paddle.h>
#import <GSPaddle/Paddle+CustomBundleIdentifier.h>
#import <GSPaddle/GSPaddleErrorCodes.h>
#import <GSPaddle/PADApi+GSPaddle.h>

// Recereate missing headers for PaddleAnalytics to disable Analytics.

@interface PaddleAnalyticsKit : NSObject

+ (void)disableTracking;
+ (BOOL)isOptedIn;

@end
@@ -0,0 +1,18 @@
//
// GSPaddleErrorCodes.h
// GSPaddle
//
// Created by Lukas Pitschl on 27.09.18.
// Copyright © 2018 Lukas Pitschl. All rights reserved.
//

#ifndef GSPaddleErrorCodes_h
#define GSPaddleErrorCodes_h

typedef enum {
GSPaddleErrorCodeNetworkError = 99,
GSPaddleErrorCodeActivationCodeNotFound = 100,
GSPaddleErrorCodeActivationCodeAlreadyUsed = 104
} GSPaddleErrorCodes;

#endif /* GSPaddleErrorCodes_h */
@@ -0,0 +1,20 @@
//
// PADApi+GSPaddle.h
// GSPaddle
//
// Created by Lukas Pitschl on 27.09.18.
// Copyright © 2018 Lukas Pitschl. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface PADApi_GSPaddle : NSObject

@end

@interface Paddle (GSPaddleMore)

- (NSError *)activationErrorForActivationCode:(NSString *)activationCode;
- (void)setActivationError:(NSError *)error forActivationCode:(NSString *)activationCode;

@end
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Info.plist</key>
<data>
6Rq8gyvwJGgu6d+s0qoEM2vG/m8=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/GSPaddle.h</key>
<dict>
<key>hash2</key>
<data>
b2CD6bKLNtrgsQF9xzXcPgpPzdA6uENGu3CTaXJbiJE=
</data>
</dict>
<key>Headers/GSPaddleErrorCodes.h</key>
<dict>
<key>hash2</key>
<data>
IzYJ7gTVtRFThhKibUhMMgvLKNqe7UbKs+lsfOYjq54=
</data>
</dict>
<key>Headers/PADApi+GSPaddle.h</key>
<dict>
<key>hash2</key>
<data>
GA1q/vOJ5pIEcJKTKNdbwkVIlYXwwAKoAcPuTPufLgQ=
</data>
</dict>
<key>Headers/Paddle+CustomBundleIdentifier.h</key>
<dict>
<key>hash2</key>
<data>
2y7lyvP3tidKNLwWVt7AkJsDleth6iu72yyjqktBqPo=
</data>
</dict>
<key>Modules/module.modulemap</key>
<dict>
<key>hash2</key>
<data>
ZSOiL3zrBK9vfTgXpOCNX5zsZRA7fEBLCKP8L9LAQGI=
</data>
</dict>
<key>Resources/Info.plist</key>
<dict>
<key>hash2</key>
<data>
bOd+8folBr1y6IRCZefTu9QysovrLJqH5kgwFuw/hmQ=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
7 changes: 7 additions & 0 deletions Source/org.gpgtools.Libmacgpg.xpc/JailfreeTask.m
Expand Up @@ -179,6 +179,10 @@ - (void)validSupportContractAvailableForProduct:(NSString *)identifier reply:(vo
- (void)activateProductWithEmail:(NSString *)email activationCode:(NSString *)activationCode reply:(void (^)(BOOL, NSError *))reply {
[self paddleInstance];
[[self paddleProduct] activateEmail:email license:activationCode completion:^(BOOL activated, NSError * _Nullable error) {
// Instead of the paddle error, it is best to use our own error which contains
// more information of what actually happened.
NSError *realError = [[self paddleInstance] activationErrorForActivationCode:activationCode];
error = realError != nil ? realError : error;
reply(activated, error);
}];
}
Expand All @@ -194,6 +198,9 @@ - (void)startTrialWithReply:(void (^)(BOOL))reply {
- (Paddle *)paddleInstance {
// While truly perverted, this swizzle is now on the NSFileManager.
[[NSFileManager defaultManager] GSSetCustomBundleIdentifier:@"GPGTools/org.gpgtools.GPGMail"];
// While this call should no longer be necessary, since the GSPaddle framework makes sure
// that only activation calls are allowed, it can't hurt to still call it.
[PaddleAnalyticsKit disableTracking];
Paddle *paddle = [Paddle sharedInstanceWithVendorID:@"2230" apiKey:@"ba08ae628cf630e40d1f8be305bbfb96" productID:@"496039" configuration:nil];

return paddle;
Expand Down

0 comments on commit e101d97

Please sign in to comment.