Repository navigation
Add support for admin api - #196
rohanshah18 wants to merge 5 commits into
Conversation
| } | ||
|
|
||
| SSLContext sslContext = SSLContext.getInstance("TLS"); | ||
| sslContext.init(keyManagers, trustManagers, new SecureRandom()); |
Check failure
Code scanning / CodeQL
`TrustManager` that accepts all certificates
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix this issue, the custom TrustManager that accepts all certificates must be removed. Instead, the code should always use proper certificate validation. If the intent is to allow self-signed certificates for certain situations, the recommended alternative is to allow users to specify a CA certificate file or certificate store for validation (as already implemented in the else branch). If an insecure mode is strictly required (e.g., for local development), add prominent warnings and/or throw a runtime exception if used outside test environments; otherwise, remove the insecure TrustManager path entirely. For now, the best fix is to remove the code placing a custom insecure TrustManager in the SSL context and make verifyingSsl == false and verifyingSsl == true behave the same: always use strict certificate validation through a proper trust manager factory.
Required changes:
- Remove (lines 1477–1492) the custom insecure X509TrustManager and HostnameVerifier.
- Always use TrustManagerFactory and OkHostnameVerifier, regardless of
verifyingSsl. - Optionally, provide a warning or exception if a user attempts to disable SSL verification, to prevent accidental use.
Problem
Describe the purpose of this change. What problem is being solved and why?
Solution
Describe the approach you took. Link to any relevant bugs, issues, docs, or other resources.
Type of Change
Test Plan
Describe specific steps for validating this change.