From 0141f65e7be21b067957a8e8cb3474ab46e12b48 Mon Sep 17 00:00:00 2001 From: Randall Lee Date: Mon, 7 May 2018 17:57:42 -0400 Subject: [PATCH] [iOS] - Update telemetry certificate pinning (#11845) * Update telemetry certificate pinning * Load both CN certificates * [ios] Use China events endpoint with China API endpoint * Update CHANGELOG.md --- platform/darwin/src/MGLNetworkConfiguration.h | 6 ++++++ platform/darwin/src/MGLNetworkConfiguration.m | 3 +++ platform/ios/CHANGELOG.md | 4 ++++ platform/ios/ios.xcodeproj/project.pbxproj | 12 ++++++++++++ .../resources/api_mapbox_cn-digicert_2018.der | Bin 0 -> 1704 bytes .../resources/api_mapbox_cn-geotrust_2018.der | Bin 0 -> 1578 bytes platform/ios/src/MGLAPIClient.m | 18 +++++++++++++++++- 7 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 platform/ios/resources/api_mapbox_cn-digicert_2018.der create mode 100644 platform/ios/resources/api_mapbox_cn-geotrust_2018.der diff --git a/platform/darwin/src/MGLNetworkConfiguration.h b/platform/darwin/src/MGLNetworkConfiguration.h index 644291ee1..f1fe7bab2 100644 --- a/platform/darwin/src/MGLNetworkConfiguration.h +++ b/platform/darwin/src/MGLNetworkConfiguration.h @@ -2,6 +2,12 @@ NS_ASSUME_NONNULL_BEGIN +/// The default base URL for Mapbox APIs other than the telemetry API. +extern NSString * const MGLDefaultMapboxAPIBaseURL; + +/// The PRC base URL for Mapbox APIs other than the telemetry API. +extern NSString * const MGLChinaMapboxAPIBaseURL; + /** The MGLNetworkConfiguration object provides a global way to set a base API URL for retrieval of map data, styles, and other resources. diff --git a/platform/darwin/src/MGLNetworkConfiguration.m b/platform/darwin/src/MGLNetworkConfiguration.m index 82d333dc9..d0ee01c5a 100644 --- a/platform/darwin/src/MGLNetworkConfiguration.m +++ b/platform/darwin/src/MGLNetworkConfiguration.m @@ -1,5 +1,8 @@ #import "MGLNetworkConfiguration.h" +NSString * const MGLDefaultMapboxAPIBaseURL = @"https://api.mapbox.com"; +NSString * const MGLChinaMapboxAPIBaseURL = @"https://api.mapbox.cn"; + @implementation MGLNetworkConfiguration + (void)load { diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 392df1d1e..1b0806b68 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,6 +2,10 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. +## 3.7.8 - May 7, 2018 + +* Improved compatibility with Mapbox China APIs. ([#11845](https://github.com/mapbox/mapbox-gl-native/pull/11845)) + ## 3.7.7 - May 3, 2018 * Fixed a crash when removing an `MGLOfflinePack`. ([#11821](https://github.com/mapbox/mapbox-gl-native/issues/11821)) diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index bbd406753..2bc216ff1 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -247,6 +247,10 @@ 968F36B51E4D128D003A5522 /* MGLDistanceFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3557F7AE1E1D27D300CCA5E6 /* MGLDistanceFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; 96E027231E57C76E004B8E66 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96E027251E57C76E004B8E66 /* Localizable.strings */; }; 96F3F73C1F57124B003E2D2C /* MGLUserLocationHeadingIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 96F3F73B1F5711F1003E2D2C /* MGLUserLocationHeadingIndicator.h */; }; + AC0C15F3209D0E6900B65675 /* api_mapbox_cn-geotrust_2018.der in Resources */ = {isa = PBXBuildFile; fileRef = AC0C15F1209D0E3600B65675 /* api_mapbox_cn-geotrust_2018.der */; }; + AC0C15F4209D0E7000B65675 /* api_mapbox_cn-geotrust_2018.der in Resources */ = {isa = PBXBuildFile; fileRef = AC0C15F1209D0E3600B65675 /* api_mapbox_cn-geotrust_2018.der */; }; + AC0C15F5209D0E7200B65675 /* api_mapbox_cn-digicert_2018.der in Resources */ = {isa = PBXBuildFile; fileRef = AC0C15F2209D0E6000B65675 /* api_mapbox_cn-digicert_2018.der */; }; + AC0C15F6209D0E7300B65675 /* api_mapbox_cn-digicert_2018.der in Resources */ = {isa = PBXBuildFile; fileRef = AC0C15F2209D0E6000B65675 /* api_mapbox_cn-digicert_2018.der */; }; AC518DFF201BB55A00EBC820 /* MGLTelemetryConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */; }; AC518E00201BB55A00EBC820 /* MGLTelemetryConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */; }; AC518E03201BB56000EBC820 /* MGLTelemetryConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */; }; @@ -756,6 +760,8 @@ 96E0272D1E57C7E6004B8E66 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/Localizable.strings; sourceTree = ""; }; 96E0272E1E57C7E7004B8E66 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = ""; }; 96F3F73B1F5711F1003E2D2C /* MGLUserLocationHeadingIndicator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLUserLocationHeadingIndicator.h; sourceTree = ""; }; + AC0C15F1209D0E3600B65675 /* api_mapbox_cn-geotrust_2018.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "api_mapbox_cn-geotrust_2018.der"; sourceTree = ""; }; + AC0C15F2209D0E6000B65675 /* api_mapbox_cn-digicert_2018.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "api_mapbox_cn-digicert_2018.der"; sourceTree = ""; }; AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLTelemetryConfig.h; sourceTree = ""; }; AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLTelemetryConfig.m; sourceTree = ""; }; CA55CD3E202C16AA00CE7095 /* MGLCameraChangeReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCameraChangeReason.h; sourceTree = ""; }; @@ -1479,6 +1485,8 @@ DAC49C5F1CD02BC9009E1AA3 /* Localizable.stringsdict */, DA8933EF1CCD387900E68420 /* strip-frameworks.sh */, 40599F001DEE1B2400182B5D /* api_mapbox_staging.der */, + AC0C15F2209D0E6000B65675 /* api_mapbox_cn-digicert_2018.der */, + AC0C15F1209D0E3600B65675 /* api_mapbox_cn-geotrust_2018.der */, 40599F011DEE1B2400182B5D /* api_mapbox_com-digicert_2016.der */, 40599F021DEE1B2400182B5D /* api_mapbox_com-geotrust_2016.der */, 40EA6BBD1EF4598900FCCDA2 /* api_mapbox_com-digicert_2017.der */, @@ -2225,12 +2233,14 @@ files = ( DA8933BC1CCD2CA100E68420 /* Foundation.strings in Resources */, DA8933A31CCC95B000E68420 /* Localizable.strings in Resources */, + AC0C15F5209D0E7200B65675 /* api_mapbox_cn-digicert_2018.der in Resources */, 960D0C361ECF5AAF008E151F /* Images.xcassets in Resources */, DA8933F01CCD387900E68420 /* strip-frameworks.sh in Resources */, DAC49C5C1CD02BC9009E1AA3 /* Localizable.stringsdict in Resources */, DA8933BF1CCD2CAD00E68420 /* Foundation.stringsdict in Resources */, 40EA6BC11EF4599600FCCDA2 /* api_mapbox_com-digicert_2017.der in Resources */, 408982E91DEE208200754016 /* api_mapbox_staging.der in Resources */, + AC0C15F3209D0E6900B65675 /* api_mapbox_cn-geotrust_2018.der in Resources */, 408982EA1DEE208B00754016 /* api_mapbox_com-digicert_2016.der in Resources */, 40EA6BC31EF4599D00FCCDA2 /* api_mapbox_com-geotrust_2017.der in Resources */, 408982EB1DEE209100754016 /* api_mapbox_com-geotrust_2016.der in Resources */, @@ -2241,6 +2251,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + AC0C15F4209D0E7000B65675 /* api_mapbox_cn-geotrust_2018.der in Resources */, DA8933E01CCD31DF00E68420 /* Localizable.strings in Resources */, DA8933DB1CCD31D400E68420 /* Foundation.strings in Resources */, 960D0C371ECF5AAF008E151F /* Images.xcassets in Resources */, @@ -2250,6 +2261,7 @@ 40599F0C1DEE1B7600182B5D /* api_mapbox_staging.der in Resources */, 40599F0D1DEE1B7A00182B5D /* api_mapbox_com-digicert_2016.der in Resources */, 40599F0E1DEE1B7E00182B5D /* api_mapbox_com-geotrust_2016.der in Resources */, + AC0C15F6209D0E7300B65675 /* api_mapbox_cn-digicert_2018.der in Resources */, 40EA6BC21EF4599700FCCDA2 /* api_mapbox_com-digicert_2017.der in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/platform/ios/resources/api_mapbox_cn-digicert_2018.der b/platform/ios/resources/api_mapbox_cn-digicert_2018.der new file mode 100644 index 0000000000000000000000000000000000000000..e458713337d86b37752ca45e2ddec1f768352d6c GIT binary patch literal 1704 zcmah}do)ye9KZL@HN#}QW<2s7Arof&#v_kbSQ>kX3Q`{D>Q4TjkI|s zm6B$a(rSsyW6^8dN+@i~p@&wR>Zmr6-L-dEot*yId(J(--}n3bzCPateo}lHK?a954F-U2PC|jjoe@UmIT8~R3H${TmsbaxNsCtM#96Gx`3=C zh-7u&1YUvO6M850I&mL=S3f>56f{KsV1vstk%CPKt zw(aLcx3dNXrbZ{FwFOyqZ}a}_R3PflX!)Ztl0h-`aN?Vb%j(wt6j>GKJ?97Dd z8IFHRM{qC%AC=*vfD9K7%&;_?SfB<#FNdO;!#0*N+5Psku>zLs8M_Bp1|I?wrGN&i zhf)}QjT~P=ZVbC#k)`>SpYeBMS;bsIO|((0O0thjp`p~(gyC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644 index 0000000000000000000000000000000000000000..e3d4b222aecfdefec1436dff7347798ca65e11cc GIT binary patch literal 1578 zcmZux3pCVO82`VFA;x3824hC77>qj}p;}^uJkzAa?nc8-)EJLp3S%>lp*kvg)X0%M zDyhh0t7Yw4DV2^z(sT&D*i@)hRJ*e?l}_#MJ?B2Y`@Qe?yB`qYEPzOfP=O*af@s3o zL)nISjd$g7R;S};T#o^DoC;0sD}JpG!%LJP@Ev0bP{E<07>$9iJH9hNP5aK6O3IgUa-v z+5?6QFws|+uTH=LydUBE>h?fR+B4)E0O7!B(Kbrdj7g1&=O@#-Q3+dlJL&9rAcB{E z9xto}p(0oVlHaQ$A{d5hmSqeEH_l8^WDd3tKPol4ax371Ta88~+}w8%r8>aiRFE`!iO!cVY@}O6x_Ep9PvS?BCw+)-T zGH2>))ryM6kLc@wz}G8dg!O`6xL~#IA=`6!Ub%xa;1heT3}6{ua}~J9@> zu44f_4#&w-gAo{{Eb72877IAQVvz>0*zjXu$^0mOO7a)6fv-QwA!5d20#OR+e<}FC zN$}tQD>4y7fC8~XoT~htF!=T^1VbKVoi zgLFp%Rfp)x1iHprQlta2!sR#OOP!^}kA6en`}GE12-T~;`R)iwmrUTY@a*4PJcDcP zsH_@Kyh@%!SvP9_9HDBbQ?J^*o3O=aMrM2a#*k8AZ5Kiat`fJ}>`$GdA+9{#R_SOP zWp83jVUgM4(}&W1Ts9S})~%m3JXjLFe7{Lw&Ih;QrJvHJ3T@L*N|aBww2!nL4>2ny z@#c_$bdu&^F=|?TYgbsN{6Qw~I5qj3jSqTsc3ISp9`CKqJ4O=*Hn*!iu1bs-;d4K4 zBl5N