From 82640cf7fcca6271b48cf64864cea084299ad332 Mon Sep 17 00:00:00 2001 From: Seandon Mooy Date: Tue, 18 Jan 2022 23:18:38 -0800 Subject: [PATCH 01/18] allow a certificate to be manually provided for certificate validation at runtime --- ios/RNSslPinning/RNSslPinning.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ios/RNSslPinning/RNSslPinning.m b/ios/RNSslPinning/RNSslPinning.m index 3179a72..b9bff57 100644 --- a/ios/RNSslPinning/RNSslPinning.m +++ b/ios/RNSslPinning/RNSslPinning.m @@ -215,6 +215,7 @@ -(void) performMultipartRequest: (AFURLSessionManager*)manager obj:(NSDictionary AFSecurityPolicy *policy; BOOL pkPinning = [[obj objectForKey:@"pkPinning"] boolValue]; BOOL disableAllSecurity = [[obj objectForKey:@"disableAllSecurity"] boolValue]; + NSString *cert=[obj objectForKey:@"cert"]; NSSet *certificates = [AFSecurityPolicy certificatesInBundle:[NSBundle mainBundle]]; @@ -227,6 +228,13 @@ -(void) performMultipartRequest: (AFURLSessionManager*)manager obj:(NSDictionary else if (pkPinning){ policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey withPinnedCertificates:certificates]; } + else if (cert) { + NSData *certData = [cert dataUsingEncoding:NSUTF8StringEncoding]; + NSSet *certSet = [NSSet setWithObject:certData]; + policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + policy.pinnedCertificates = (NSSet *)@[certSet]; + policy.validatesDomainName = false; + } else{ policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate withPinnedCertificates:certificates]; } From cea4971a17cd46628f6f23d2d6102e9999f4cd81 Mon Sep 17 00:00:00 2001 From: Seandon Mooy Date: Wed, 19 Jan 2022 16:55:26 -0800 Subject: [PATCH 02/18] properly pin certificates --- ios/RNSslPinning/RNSslPinning.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ios/RNSslPinning/RNSslPinning.m b/ios/RNSslPinning/RNSslPinning.m index b9bff57..bb6dfe5 100644 --- a/ios/RNSslPinning/RNSslPinning.m +++ b/ios/RNSslPinning/RNSslPinning.m @@ -215,7 +215,7 @@ -(void) performMultipartRequest: (AFURLSessionManager*)manager obj:(NSDictionary AFSecurityPolicy *policy; BOOL pkPinning = [[obj objectForKey:@"pkPinning"] boolValue]; BOOL disableAllSecurity = [[obj objectForKey:@"disableAllSecurity"] boolValue]; - NSString *cert=[obj objectForKey:@"cert"]; + NSString *certBase64=[obj objectForKey:@"cert"]; NSSet *certificates = [AFSecurityPolicy certificatesInBundle:[NSBundle mainBundle]]; @@ -228,12 +228,13 @@ -(void) performMultipartRequest: (AFURLSessionManager*)manager obj:(NSDictionary else if (pkPinning){ policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey withPinnedCertificates:certificates]; } - else if (cert) { - NSData *certData = [cert dataUsingEncoding:NSUTF8StringEncoding]; - NSSet *certSet = [NSSet setWithObject:certData]; - policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; - policy.pinnedCertificates = (NSSet *)@[certSet]; + else if (certBase64) { + NSURL *certData = [NSURL URLWithString: [NSString stringWithFormat:@"data:application/octet-stream;base64,%@", certBase64]]; + NSData *certRaw = [NSData dataWithContentsOfURL:certData]; + policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate + withPinnedCertificates:[NSSet setWithObject:certRaw]]; policy.validatesDomainName = false; + policy.allowInvalidCertificates = true; } else{ policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate withPinnedCertificates:certificates]; From 7009fd88fdaa5ffc476af3283a130a5e22585674 Mon Sep 17 00:00:00 2001 From: buekera Date: Mon, 31 Jan 2022 14:03:23 +0100 Subject: [PATCH 03/18] bump com.squareup.okhttp3 version to 4.9 --- android/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 8e32614..efb23b8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -32,10 +32,10 @@ repositories { dependencies { implementation "com.facebook.react:react-native:+" - implementation "com.squareup.okhttp3:okhttp:4.2.2" + implementation "com.squareup.okhttp3:okhttp:4.9.0" implementation "com.squareup.okio:okio:2.6.0" implementation "com.github.franmontiel:PersistentCookieJar:v1.0.1" - implementation "com.squareup.okhttp3:logging-interceptor:4.2.2" - implementation "com.squareup.okhttp3:okhttp-urlconnection:4.2.2" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.0" + implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.0" } From 684cf866907cdf88b4d23b93687c154ab15da5c5 Mon Sep 17 00:00:00 2001 From: mpperez Date: Tue, 15 Mar 2022 17:31:07 +0100 Subject: [PATCH 04/18] npm v7 - updated rn peer dependency (any version) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b645475..f25d2eb 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "license": "MIT", "homepage": "https://github.com/MaxToyberman/react-native-ssl-pinning#README", "peerDependencies": { - "react-native": "^0.41.2" + "react-native": "*" }, "repository": { "type": "git", From 3e25f3174f3382d34d57193f98f41db692f31f98 Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Tue, 29 Mar 2022 15:32:05 +0300 Subject: [PATCH 05/18] Release 1.5.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f25d2eb..9cb0c91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-ssl-pinning", - "version": "1.5.4", + "version": "1.5.5", "description": "React-Native Ssl pinning using OkHttp 3 in Android, and AFNetworking on iOS.", "main": "index.js", "scripts": { From 52ed2d1de029bb982514369adb5c1380b419ffcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=CC=8Ans=20Dahlstro=CC=88m?= Date: Mon, 27 Jun 2022 16:25:57 +0200 Subject: [PATCH 06/18] Move podspec file to project root --- ios/RNSslPinning.podspec => RNSslPinning.podspec | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) rename ios/RNSslPinning.podspec => RNSslPinning.podspec (74%) diff --git a/ios/RNSslPinning.podspec b/RNSslPinning.podspec similarity index 74% rename from ios/RNSslPinning.podspec rename to RNSslPinning.podspec index 4df35d2..538e9b1 100644 --- a/ios/RNSslPinning.podspec +++ b/RNSslPinning.podspec @@ -1,6 +1,6 @@ require 'json' -package = JSON.parse(File.read(File.join(__dir__, '../package.json'))) +package = JSON.parse(File.read(File.join(__dir__, './package.json'))) Pod::Spec.new do |s| s.name = "RNSslPinning" @@ -10,10 +10,10 @@ Pod::Spec.new do |s| s.homepage = package['homepage'] s.license = package['license'] # s.license = { :type => "MIT", :file => "FILE_LICENSE" } - s.author = { "author" => "author@domain.cn" } + s.author = { "author" => "author@domain.cn" } s.platform = :ios, "9.0" s.source = { :git => "https://github.com/MaxToyberman/react-native-ssl-pinning", :tag => "master" } - s.source_files = "RNSslPinning/**/*.{h,m}" + s.source_files = "ios/RNSslPinning/**/*.{h,m}" s.requires_arc = true @@ -21,5 +21,3 @@ Pod::Spec.new do |s| s.dependency "AFNetworking", "~> 4.0" end - - \ No newline at end of file From 6a254763e232240915ec4dcd056f5fd33b85a852 Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:05:17 +0300 Subject: [PATCH 07/18] Release 1.5.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9cb0c91..ff2f8b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-ssl-pinning", - "version": "1.5.5", + "version": "1.5.6", "description": "React-Native Ssl pinning using OkHttp 3 in Android, and AFNetworking on iOS.", "main": "index.js", "scripts": { From 5fb51e900ca5dcc7d6e4565a420fe458787f25aa Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:10:23 +0300 Subject: [PATCH 08/18] Set ownership in npm publish --- .github/workflows/npm-publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 3260c8e..31228de 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -26,3 +26,7 @@ jobs: env: # More info about the environment variables in the README GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings + - name: Set ownership + run: | + # this is to fix GIT not liking owner of the checkout dir + chown -R $(id -u):$(id -g) $PWD From 0fa0049cd31cf6819bdbc65aa20b842062726d6e Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:12:22 +0300 Subject: [PATCH 09/18] Release 1.5.6 From 14f16c5ff95d1515f19d7dbd197ce70e67b10d1f Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:16:05 +0300 Subject: [PATCH 10/18] Set ownership as first step --- .github/workflows/npm-publish.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 31228de..0144057 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,6 +8,10 @@ jobs: name: npm-publish runs-on: ubuntu-latest steps: + - name: Set ownership + run: | + # this is to fix GIT not liking owner of the checkout dir + chown -R $(id -u):$(id -g) $PWD - name: Checkout repository uses: actions/checkout@master - name: Set up Node.js @@ -25,8 +29,4 @@ jobs: publish_args: "--non-interactive" env: # More info about the environment variables in the README GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings - - name: Set ownership - run: | - # this is to fix GIT not liking owner of the checkout dir - chown -R $(id -u):$(id -g) $PWD + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings \ No newline at end of file From 48eb04d735a7341ccecae4a4656f159baccfb7c2 Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:17:15 +0300 Subject: [PATCH 11/18] Add new line at end of file --- .github/workflows/npm-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 0144057..f775195 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -29,4 +29,5 @@ jobs: publish_args: "--non-interactive" env: # More info about the environment variables in the README GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings \ No newline at end of file + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings + \ No newline at end of file From 240022ef507ef99f6ba52166db867d64448552a7 Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:37:59 +0300 Subject: [PATCH 12/18] Release 1.5.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ff2f8b2..78b7e7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-ssl-pinning", - "version": "1.5.6", + "version": "1.5.7", "description": "React-Native Ssl pinning using OkHttp 3 in Android, and AFNetworking on iOS.", "main": "index.js", "scripts": { From 91360b5f81aab1fbd91bd8e67e59e0329ab4b0cb Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 13:03:03 +0300 Subject: [PATCH 13/18] Update npm-publish-action --- .github/workflows/npm-publish.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index f775195..b5bf8f3 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,10 +8,6 @@ jobs: name: npm-publish runs-on: ubuntu-latest steps: - - name: Set ownership - run: | - # this is to fix GIT not liking owner of the checkout dir - chown -R $(id -u):$(id -g) $PWD - name: Checkout repository uses: actions/checkout@master - name: Set up Node.js @@ -19,7 +15,7 @@ jobs: with: node-version: 10.0.0 - name: Publish if version has been updated - uses: pascalgn/npm-publish-action@1.3.4 + uses: pascalgn/npm-publish-action@1.3.9 with: # All of theses inputs are optional tag_name: "v%s" tag_message: "v%s" From c485f502016e783c4fe9adf3c958c7601b6370bb Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 13:15:47 +0300 Subject: [PATCH 14/18] Release 1.5.7 From d336de5853bd17188ac935ba84b8fed7c2d515ff Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:12:22 +0300 Subject: [PATCH 15/18] Release 1.5.6 From 0a46094389bccb2625121066461ace7dbe7aa846 Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 13:15:47 +0300 Subject: [PATCH 16/18] Release 1.5.7 From f3f2de5c6ba3fbebb3dc8a2a2f6d6149019ef645 Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 12:12:22 +0300 Subject: [PATCH 17/18] Release 1.5.6 From 17cd1d0d1c9643fffd9004bc9497c703e4a31125 Mon Sep 17 00:00:00 2001 From: Max Toyberman Date: Fri, 12 Aug 2022 13:15:47 +0300 Subject: [PATCH 18/18] Release 1.5.7