Skip to content

Commit 4f84f62

Browse files
authored
Fix(CertificateTransparency): remove deprecated certificate transparency logic (#40)
Google will not allow certificate transparency from third party library so we deprecate this part of the code for Android. SSLPinning is untouched.
1 parent 76041cc commit 4f84f62

3 files changed

Lines changed: 1 addition & 44 deletions

File tree

README.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
- [Pinning subdomains](#pinning-subdomains)
1010
- [Generating the public key hashes](#generating-the-public-key-hashes)
1111
- [Testing](#testing)
12-
- [Certificate transparency](#certificate-transparency)
13-
- [Configuration](#configuration-1)
1412
- [Prevent "recent screenshots"](#prevent-recent-screenshots)
15-
- [Configuration](#configuration-2)
13+
- [Configuration](#configuration-1)
1614
- [Safe Keyboard Detector](#safe-keyboard-detector)
1715
- [[EXPERIMENTAL - iOS only] Disable Default Caching in `Cache.db`](#experimental---ios-only-disable-default-caching-in-cachedb)
1816
- [Contributing](#contributing)
@@ -127,21 +125,6 @@ To test that SSL pinning is working as expected, you can:
127125
- break (change) a certificate and check that the connection fails _(don't forget to `yarn expo prebuild` then `yarn ios` or `yarn android` to rebuild the app)_
128126
- set up a proxy (we love [Proxyman](https://proxyman.io)) and check that the connection fails
129127

130-
## Certificate transparency
131-
132-
> **🥷 What's the threat?** Compromised certificate authorities. [More details](https://certificate.transparency.dev)
133-
134-
135-
Certificate Transparency (CT) is a mechanism that ensures that certificates are publicly logged in auditable, append-only logs. Rather than directly verifying log inclusion, CT relies on Signed Certificate Timestamps (SCTs), which provide a cryptographic proof that a certificate has been submitted to a trusted log.
136-
137-
- On iOS, [Certificate Transparency is enforced by default](https://developer.apple.com/documentation/ios-ipados-release-notes/ios-12_1_1-release-notes) since _iOS 12.1.1_. The system validates that certificates comply with CT requirements, including the presence of valid Signed Certificate Timestamps (SCTs) issued by trusted logs.
138-
139-
- On Android, this package enables Certificate Transparency for _Android >= 8.0_ using [appmattus/certificatetransparency](https://github.com/appmattus/certificatetransparency). It installs a network interceptor that validates, for each request, that the server certificate contains valid SCTs issued by trusted CT logs. This verification relies on a static list of trusted logs (`log_list.json`) bundled at build time, with no dynamic updates at runtime.
140-
141-
### Configuration
142-
143-
None, enabled by default.
144-
145128
## Prevent "recent screenshots"
146129

147130
> **🥷 What's the threat?** When the OS terminates the app, it may take a screenshot and store it on the device to display in the app switcher. This screenshot could leak sensitive data

android/build.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,4 @@ dependencies {
9797
// package-specific dependencies
9898
implementation("com.facebook.react:react-native:+")
9999

100-
/*
101-
* See https://github.com/bamlab/react-native-app-security/issues/15
102-
* appmattus.certificatetransparency >= 2.5.75 is built with Kotlin 2.
103-
* However, React Native projects < 0.77 are usually built with Kotlin 1.
104-
* Avoid failing builds, at the cost of not getting the latest CT info
105-
* TODO: Remove this when React Native 0.76 is EOL
106-
*/
107-
def certificateTransparencyVersion = "2.8+"
108-
if (getKotlinVersion().startsWith("1.")) {
109-
certificateTransparencyVersion = "2.5.74"
110-
}
111-
112-
implementation("com.appmattus.certificatetransparency:certificatetransparency:${certificateTransparencyVersion}")
113100
}

android/src/main/java/tech/bam/rnas/HttpClientOverride.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package tech.bam.rnas
22

3-
import android.os.Build
43
import com.facebook.react.modules.network.OkHttpClientFactory;
54
import com.facebook.react.modules.network.OkHttpClientProvider;
65

76
import okhttp3.CertificatePinner;
87
import okhttp3.OkHttpClient;
98

10-
import com.appmattus.certificatetransparency.CTInterceptorBuilder
11-
129
import org.json.JSONObject
1310

1411
public class SSLPinning : OkHttpClientFactory {
@@ -30,16 +27,6 @@ public class SSLPinning : OkHttpClientFactory {
3027

3128
clientBuilder.certificatePinner(certificatePinnerBuilder.build())
3229

33-
// -- Certificate Transparency --
34-
35-
/*
36-
* The library for certificate transparency does not support Android sdk version < 26 (Android 8.0) without setting up "desugaring"
37-
* See more : https://github.com/appmattus/certificatetransparency#getting-started
38-
*/
39-
if (Build.VERSION.SDK_INT >= 26) {
40-
clientBuilder.addNetworkInterceptor(CTInterceptorBuilder().build())
41-
}
42-
4330
return clientBuilder.build()
4431
}
4532

0 commit comments

Comments
 (0)