-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
Summary
- Certificate validation is disabled by a custom
X509TrustManagerthat trusts all certificates. - Hostname verification is disabled by a custom
HostnameVerifierthat allows any hostname. - These disable core TLS protections, enabling trivial MitM, token theft, and tampering.
- Additional concerns: allowing
http://base paths and setting a global JVMAuthenticatorfor proxy credentials.
Impact (why this is critical)
- Man‑in‑the‑Middle: Any on‑path attacker can intercept and alter traffic.
- Credential/PII exposure: OAuth tokens, API keys, and document data can be exfiltrated.
- Response tampering: Server responses can be modified without detection.
- Cross‑JVM leakage: Global
Authenticatormay leak proxy credentials to other HTTP clients in the same JVM.
Evidence (where this happens)
SecureTrustManager(inner class) implementsX509TrustManagerbut does no checks (checkServerTrusted/checkClientTrustedempty; always trusts).InsecureHostnameVerifier(inner class) returnstruefor all hosts.buildHttpClient(...)installs both the above into theSSLContextand connection factory.invokeAPI(...)does not enforcehttps://forbasePath.buildHttpClient(...)sets a global proxyAuthenticatorviaAuthenticator.setDefault(...)when proxy creds are present.
Root cause / probable intent
Likely added to simplify local testing against self‑signed endpoints. However, shipping these defaults to end users leaves production clients insecure by default.
Recommendations (secure by default)
- Remove trust‑all and insecure hostname verification by default
- Use the platform default
X509TrustManagerand defaultHostnameVerifier. - If truly needed for local testing, gate with an explicit, off‑by‑default flag such as system property
docusign.sdk.allowInsecure=trueand add prominent warnings.
- Use the platform default
- Enforce HTTPS
- Reject any
basePaththat does not start withhttps://(fail fast with clear error).
- Reject any
- Avoid global proxy authenticator
- Do not call
Authenticator.setDefault(...). Prefer per‑connection authentication or document a pluggable proxy authenticator scoped to this client only.
- Do not call
- Document security posture
- Clearly document that production usage requires default TLS verification and HTTPS.
Acceptance criteria
- Removing or disabling
SecureTrustManagerandInsecureHostnameVerifierresults in certificate/hostname validation being performed by default. - Attempts to set
basePathtohttp://...throw a clear exception. - No calls to
Authenticator.setDefault(...)are made by default; proxy creds are scoped to this client/connector only. - Unit/integration tests cover: (a) valid TLS handshake with proper certificates, (b) rejection of invalid certificates/hostnames, (c) rejection of
http://base paths.
References
- OWASP Transport Layer Protection Cheat Sheet
- RFC 2818 (HTTP over TLS) — hostname verification
- Oracle Java Secure Socket documentation
Metadata
Metadata
Assignees
Labels
No labels