Skip to content

Commit d5e243d

Browse files
Merge pull request #537 from dropbox/jfein/remove-cert-pinning
Remove cert pinning from the SDK
2 parents 0f765cb + fa4c4c1 commit d5e243d

File tree

17 files changed

+49
-1870
lines changed

17 files changed

+49
-1870
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath files('gradle/dropbox-pem-converter-plugin')
109
classpath(dropboxJavaSdkLibs.android.gradle.plugin)
1110
classpath(dropboxJavaSdkLibs.kotlin.gradle.plugin)
1211
classpath("com.dropbox.gradle.plugins:stone-java-gradle-plugin")

core/api/core.api

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,17 +519,6 @@ public final class com/dropbox/core/http/OkHttpRequestor$AsyncCallback : com/squ
519519
public fun onResponse (Lcom/squareup/okhttp/Response;)V
520520
}
521521

522-
public class com/dropbox/core/http/SSLConfig {
523-
public fun <init> ()V
524-
public static fun apply (Ljavax/net/ssl/HttpsURLConnection;)V
525-
public static fun getSSLSocketFactory ()Ljavax/net/ssl/SSLSocketFactory;
526-
public static fun getTrustManager ()Ljavax/net/ssl/X509TrustManager;
527-
}
528-
529-
public final class com/dropbox/core/http/SSLConfig$LoadException : java/lang/Exception {
530-
public fun <init> (Ljava/lang/String;Ljava/lang/Throwable;)V
531-
}
532-
533522
public class com/dropbox/core/http/StandardHttpRequestor : com/dropbox/core/http/HttpRequestor {
534523
public static final field INSTANCE Lcom/dropbox/core/http/StandardHttpRequestor;
535524
public fun <init> (Lcom/dropbox/core/http/StandardHttpRequestor$Config;)V
@@ -553,6 +542,7 @@ public final class com/dropbox/core/http/StandardHttpRequestor$Config {
553542
public fun getConnectTimeoutMillis ()J
554543
public fun getProxy ()Ljava/net/Proxy;
555544
public fun getReadTimeoutMillis ()J
545+
public fun getSslSocketFactory ()Ljavax/net/ssl/SSLSocketFactory;
556546
}
557547

558548
public final class com/dropbox/core/http/StandardHttpRequestor$Config$Builder {
@@ -562,6 +552,7 @@ public final class com/dropbox/core/http/StandardHttpRequestor$Config$Builder {
562552
public fun withNoReadTimeout ()Lcom/dropbox/core/http/StandardHttpRequestor$Config$Builder;
563553
public fun withProxy (Ljava/net/Proxy;)Lcom/dropbox/core/http/StandardHttpRequestor$Config$Builder;
564554
public fun withReadTimeout (JLjava/util/concurrent/TimeUnit;)Lcom/dropbox/core/http/StandardHttpRequestor$Config$Builder;
555+
public fun withSslSocketFactory (Ljavax/net/ssl/SSLSocketFactory;)Lcom/dropbox/core/http/StandardHttpRequestor$Config$Builder;
565556
}
566557

567558
public class com/dropbox/core/json/JsonArrayReader : com/dropbox/core/json/JsonReader {

core/build.gradle

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,6 @@ configurations {
8282
withoutOsgi.extendsFrom api
8383
}
8484

85-
processResources { task ->
86-
filesMatching('**/*.crt') { fcd ->
87-
def inputstream = fcd.open()
88-
def certDatas = com.dropbox.maven.pem_converter.PemLoader.load(
89-
new InputStreamReader(inputstream, "UTF-8")
90-
)
91-
inputstream.close()
92-
93-
def crtPath = fcd.getPath()
94-
def rawPath = crtPath.substring(0, crtPath.length() - 4) + ".raw"
95-
def rawFile = new File(task.getDestinationDir(), rawPath);
96-
rawFile.getParentFile().mkdirs();
97-
def out = new DataOutputStream(new FileOutputStream(rawFile))
98-
com.dropbox.maven.pem_converter.RawLoader.store(certDatas, out)
99-
out.close()
100-
101-
fcd.exclude()
102-
}
103-
}
104-
10585
tasks.named("compileJava", JavaCompile) {
10686
options.compilerArgs << '-Xlint:all'
10787
options.warnings = true

core/src/main/java/com/dropbox/core/http/OkHttp3Requestor.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ public static OkHttpClient.Builder defaultOkHttpClientBuilder() {
4242
return new OkHttpClient.Builder()
4343
.connectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
4444
.readTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
45-
.writeTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
46-
// enables certificate pinning
47-
.sslSocketFactory(SSLConfig.getSSLSocketFactory(), SSLConfig.getTrustManager());
45+
.writeTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
4846
}
4947

5048
private final OkHttpClient client;
@@ -68,17 +66,6 @@ public static OkHttpClient.Builder defaultOkHttpClientBuilder() {
6866
* .build();
6967
* </pre>
7068
*
71-
* <p>
72-
* If you don't use {@link #defaultOkHttpClient()} or {@link #defaultOkHttpClientBuilder()},
73-
* make sure to use Dropbox's hardened SSL settings from {@link SSLConfig}:
74-
* </p>
75-
*
76-
* <pre>
77-
* OkHttpClient client = OkHttpClient.Builder()
78-
* ...
79-
* .sslSocketFactory(SSLConfig.getSSLSocketFactory(), SSLConfig.getTrustManager())
80-
* .build();
81-
* </pre>
8269
*/
8370
public OkHttp3Requestor(OkHttpClient client) {
8471
if (client == null) throw new NullPointerException("client");

core/src/main/java/com/dropbox/core/http/OkHttpRequestor.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public static OkHttpClient defaultOkHttpClient() {
4040
client.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
4141
client.setReadTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
4242
client.setWriteTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
43-
// enables certificate pinning
44-
client.setSslSocketFactory(SSLConfig.getSSLSocketFactory());
4543
return client;
4644
}
4745

@@ -61,14 +59,6 @@ public static OkHttpClient defaultOkHttpClient() {
6159
* HttpRequestor requestor = new OkHttpRequestor(client);
6260
* </pre>
6361
*
64-
* <p>
65-
* If you don't use {@link #defaultOkHttpClient()}, make sure to use Dropbox's
66-
* hardened SSL settings from {@link SSLConfig}:
67-
* </p>
68-
*
69-
* <pre>
70-
* client.setSslSocketFactory(SSLConfig.getSSLSocketFactory())
71-
* </pre>
7262
*/
7363
public OkHttpRequestor(OkHttpClient client) {
7464
if (client == null) throw new NullPointerException("client");

0 commit comments

Comments
 (0)