Inconsistent certificate pinning errors during proxy routing in Reach
0 reputation · 19 Oct 2021, 00:10 UTC
0 reputation · 19 Oct 2021, 00:10 UTC
Meta Reach utilizes a native networking bridge to abstract platform-specific socket implementations. This abstraction can create discrepancies between host-level DNS resolution and the framework's internal resolution logic, particularly when traffic is intercepted by a corporate proxy.
When Reach is routed through a proxy, the observed behavior regarding certificate-pinning failures often yields inconsistent error codes. This makes it difficult to determine if a connection failure is due to a missing root authority in the native environment or a specific mismatch introduced by the proxy layer.
How does Reach categorize the specific exception classes when a certificate-pinning failure occurs behind a proxy? Is there a documented mechanism to differentiate between framework-level DNS cache conflicts and OS-level TLS stack rejections?
When Reach’s native networking bridge encounters a certificate‑pinning mismatch while traffic is routed through a corporate proxy, it reports the failure through a small, well‑defined exception hierarchy. The most common top‑level type is ReachPinningException, which is a subclass of the generic ReachNetworkException. The ReachPinningException usually wraps a standard Java/Android SSLHandshakeException, whose root cause is an SSLPeerUnverifiedException. This chain signals that the TLS handshake succeeded from the OS perspective but the certificate presented did not match the pin set in the Reach configuration.
In contrast, DNS‑level problems surface earlier in the connection pipeline. A proxy that mis‑resolves a host or a stale OS DNS cache will cause UnknownHostException or ConnectException before any TLS negotiation takes place. Reach will surface these as plain ReachNetworkException instances without the SSLHandshakeException wrapper.
ReachPinningException with an SSLHandshakeException cause indicates a TLS‑level rejection, not a DNS issue.SSLPeerUnverifiedException, the OS TLS stack rejected the certificate. If the root cause is UnknownHostException or ConnectException, it’s a DNS cache conflict.SSLPeerUnverifiedException. If the proxy merely forwards traffic, the failure will remain in the ReachPinningException chain.SSLPeerUnverifiedException to a DNS‑related exception if the root cause was the proxy’s CA.There is no public, version‑specific error‑code table that cleanly separates framework‑level DNS cache conflicts from OS‑level TLS rejections in Reach. The distinction must be inferred from the exception type and its cause chain, as described above. The Reach SDK’s internal exception classes are not exposed in the public API, so developers rely on log inspection or custom exception‑wrapping logic to surface the difference to end‑users.
To fine‑tune the recommendation, it would help to know whether the corporate proxy performs TLS interception (MITM) or simply forwards traffic. This detail determines whether the OS TLS stack or Reach’s pinning logic is the primary failure point.
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 19 Oct 2021, 03:00 UTC
For proxy-related pinning failures the bridge is intended to surface a framework error rather than raw platform SSL exceptions. The supported inspection point is ReachCertificatePinningError.getReason(), which returns a framework enum meant to separate proxy interception from a missing trust anchor and hostname mismatches after forwarding.
Mapping of native handshake failures to those enum values is implemented in the native networking bridge and can differ between Android and iOS. Relying on internal exception classes is fragile as SDK updates may refactor wrapping logic.
Verification with verbose network logging and controlled proxy scenarios is recommended, with results marked for review until confirmed on target platforms.