Reject invalid TLS proxy configurations.

This commit is contained in:
andrew-signal
2025-03-21 16:06:59 -04:00
committed by Cody Henthorne
parent 9b98337e82
commit 41783368bd

View File

@@ -6,9 +6,13 @@
package org.whispersystems.signalservice.internal.websocket
import org.signal.core.util.logging.Log
import org.signal.core.util.orNull
import org.signal.libsignal.net.Network
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration
import java.io.IOException
private const val TAG = "LibSignalNetworkExtensions"
/**
* Helper method to apply settings from the SignalServiceConfiguration.
@@ -19,7 +23,12 @@ fun Network.applyConfiguration(config: SignalServiceConfiguration) {
if (proxy == null) {
this.clearProxy()
} else {
this.setProxy(proxy.host, proxy.port)
try {
this.setProxy(proxy.host, proxy.port)
} catch (e: IOException) {
Log.e(TAG, "Invalid proxy configuration set! Failing connections until changed.")
this.setInvalidProxy()
}
}
this.setCensorshipCircumventionEnabled(config.censored)