Skip to content

feat(lsp): respect IDE user proxy settings / forward trust store #5553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import com.intellij.openapi.util.Key
import com.intellij.openapi.util.SystemInfo
import com.intellij.util.io.await
import com.intellij.util.net.HttpConfigurable

Check failure on line 23 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of API marked for removal

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure

Code scanning / QDJVMC

Usage of API marked for removal Error

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal
import com.intellij.util.net.JdkProxyProvider
import io.ktor.util.network.hostname
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.TimeoutCancellationException
Expand All @@ -29,6 +32,7 @@
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withTimeout
import org.apache.http.client.utils.URIBuilder
import org.eclipse.lsp4j.ClientCapabilities
import org.eclipse.lsp4j.ClientInfo
import org.eclipse.lsp4j.DidChangeConfigurationParams
Expand All @@ -45,6 +49,7 @@
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.info
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.core.utils.writeText
import software.aws.toolkits.jetbrains.isDeveloperMode
import software.aws.toolkits.jetbrains.services.amazonq.lsp.artifacts.ArtifactManager
import software.aws.toolkits.jetbrains.services.amazonq.lsp.auth.DefaultAuthCredentialsService
Expand All @@ -54,6 +59,7 @@
import software.aws.toolkits.jetbrains.services.amazonq.lsp.textdocument.TextDocumentServiceHandler
import software.aws.toolkits.jetbrains.services.amazonq.lsp.util.WorkspaceFolderUtil.createWorkspaceFolders
import software.aws.toolkits.jetbrains.services.amazonq.lsp.workspace.WorkspaceServiceHandler
import software.aws.toolkits.jetbrains.services.amazonq.profile.QEndpoints
import software.aws.toolkits.jetbrains.services.telemetry.ClientMetadata
import software.aws.toolkits.jetbrains.settings.LspSettings
import java.io.IOException
Expand All @@ -62,7 +68,11 @@
import java.io.PipedOutputStream
import java.io.PrintWriter
import java.io.StringWriter
import java.net.Proxy
import java.net.URI
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.util.Base64
import java.util.concurrent.Future
import kotlin.time.Duration.Companion.seconds

Expand Down Expand Up @@ -250,13 +260,55 @@
init {
// will cause slow service init, but maybe fine for now. will not block UI since fetch/extract will be under background progress
val artifact = runBlocking { ArtifactManager(project, manifestRange = null).fetchArtifact() }.toAbsolutePath()

// more slowness
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: slowness added to which process?

// make assumption that all requests will resolve to the same CA
// also terrible assumption that default endpoint is reachable
val qUri = URI(QEndpoints.Q_DEFAULT_SERVICE_CONFIG.ENDPOINT)
val rtsTrustChain = TrustChainUtil.getTrustChain(qUri)
val extraCaCerts = Files.createTempFile("q-extra-ca", ".pem").apply {
writeText(
buildList {
rtsTrustChain.forEach {
add("-----BEGIN CERTIFICATE-----")
add(Base64.getMimeEncoder(64, System.lineSeparator().toByteArray()).encodeToString(it.encoded))
add("-----END CERTIFICATE-----")
}
}.joinToString(separator = System.lineSeparator())

Check warning on line 277 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L267-L277

Added lines #L267 - L277 were not covered by tests
)
}

Check warning on line 279 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L279

Added line #L279 was not covered by tests

val node = if (SystemInfo.isWindows) "node.exe" else "node"
val cmd = GeneralCommandLine(
artifact.resolve(node).toString(),
LspSettings.getInstance().getArtifactPath() ?: artifact.resolve("aws-lsp-codewhisperer.js").toString(),
"--stdio",
"--set-credentials-encryption-key",
).withEnvironment(
buildMap {
put("NODE_EXTRA_CA_CERTS", extraCaCerts.toAbsolutePath().toString())

Check warning on line 289 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L287-L289

Added lines #L287 - L289 were not covered by tests

val proxy = JdkProxyProvider.getInstance().proxySelector.select(qUri)

Check warning on line 291 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L291

Added line #L291 was not covered by tests
// log if only socks proxy available
.firstOrNull { it.type() == Proxy.Type.HTTP }

if (proxy != null) {
val address = proxy.address()

Check warning on line 296 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L296

Added line #L296 was not covered by tests
if (address is java.net.InetSocketAddress) {
put(
"HTTPS_PROXY",
URIBuilder("http://${address.hostname}:${address.port}").apply {
val login = HttpConfigurable.getInstance().proxyLogin

Check failure on line 301 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of API marked for removal

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure on line 301 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of API marked for removal

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure on line 301 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of API marked for removal

'getProxyLogin()' is deprecated and marked for removal

Check warning on line 301 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L298-L301

Added lines #L298 - L301 were not covered by tests

Check failure

Code scanning / QDJVMC

Usage of API marked for removal Error

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure

Code scanning / QDJVMC

Usage of API marked for removal Error

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure

Code scanning / QDJVMC

Usage of API marked for removal Error

'getProxyLogin()' is deprecated and marked for removal
if (login != null) {
setUserInfo(login, HttpConfigurable.getInstance().plainProxyPassword)

Check failure on line 303 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of API marked for removal

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure on line 303 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of API marked for removal

'getPlainProxyPassword()' is deprecated and marked for removal

Check failure on line 303 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of API marked for removal

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check warning on line 303 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L303

Added line #L303 was not covered by tests

Check failure

Code scanning / QDJVMC

Usage of API marked for removal Error

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure

Code scanning / QDJVMC

Usage of API marked for removal Error

'com.intellij.util.net.HttpConfigurable' is deprecated and marked for removal

Check failure

Code scanning / QDJVMC

Usage of API marked for removal Error

'getPlainProxyPassword()' is deprecated and marked for removal
}
}.build().toASCIIString()

Check warning on line 305 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L305

Added line #L305 was not covered by tests
)
}
}
}

Check warning on line 309 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L309

Added line #L309 was not covered by tests
)
.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE)

Check warning on line 311 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L311

Added line #L311 was not covered by tests

launcherHandler = KillableColoredProcessHandler.Silent(cmd)
val inputWrapper = LSPProcessListener()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.jetbrains.services.amazonq.lsp

import com.intellij.util.io.DigestUtil
import com.intellij.util.net.JdkProxyProvider
import com.intellij.util.net.ssl.CertificateManager
import org.apache.http.client.methods.RequestBuilder
import org.apache.http.conn.ssl.DefaultHostnameVerifier
import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.impl.client.SystemDefaultCredentialsProvider
import org.apache.http.impl.conn.SystemDefaultRoutePlanner
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.warn
import java.net.URI
import java.security.KeyStore
import java.security.cert.CertPathBuilder
import java.security.cert.CertStore
import java.security.cert.Certificate
import java.security.cert.CollectionCertStoreParameters
import java.security.cert.PKIXBuilderParameters
import java.security.cert.PKIXCertPathBuilderResult
import java.security.cert.X509CertSelector
import java.security.cert.X509Certificate
import kotlin.collections.ifEmpty

object TrustChainUtil {
private val LOG = getLogger<TrustChainUtil>()

Check warning on line 29 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L29

Added line #L29 was not covered by tests

/**
* Build and validate the complete certificate chain
* @param certs The end-entity certificate
* @param trustAnchors The truststore containing trusted CA certificates
* @return The complete certificate chain
*/
fun resolveTrustChain(certs: Collection<X509Certificate>, trustAnchors: KeyStore): List<X509Certificate> {

Check notice on line 37 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Function 'resolveTrustChain' could be private
// Create the selector for the certificate
val selector = X509CertSelector()
selector.certificate = certs.first()

Check warning on line 40 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L39-L40

Added lines #L39 - L40 were not covered by tests

// Create the parameters for path validation
val pkixParams = PKIXBuilderParameters(trustAnchors, selector)

Check warning on line 43 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L43

Added line #L43 was not covered by tests

// Disable CRL checking since we just want to build the path
pkixParams.isRevocationEnabled = false

Check warning on line 46 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L46

Added line #L46 was not covered by tests

// Create a CertStore containing the certificate we want to validate
val ccsp = CollectionCertStoreParameters(certs)
val certStore = CertStore.getInstance("Collection", ccsp)
pkixParams.addCertStore(certStore)

Check warning on line 51 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L49-L51

Added lines #L49 - L51 were not covered by tests

// Get the certification path
val builder = CertPathBuilder.getInstance("PKIX")
val result = builder.build(pkixParams) as PKIXCertPathBuilderResult
val certPath = result.certPath
val chain = (certPath.certificates as List<X509Certificate>).toMutableList()

Check warning on line 57 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L54-L57

Added lines #L54 - L57 were not covered by tests

// Add the trust anchor (root CA) to complete the chain
val trustAnchorCert = result.trustAnchor.trustedCert

Check warning on line 60 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L60

Added line #L60 was not covered by tests
if (trustAnchorCert != null) {
chain.add(trustAnchorCert)

Check warning on line 62 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L62

Added line #L62 was not covered by tests
}

return chain

Check warning on line 65 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L65

Added line #L65 was not covered by tests
}

fun getTrustChain(uri: URI): List<X509Certificate> {
val proxyProvider = JdkProxyProvider.getInstance()
var peerCerts: Array<Certificate> = emptyArray()
val verifierDelegate = DefaultHostnameVerifier()
val client = HttpClientBuilder.create()
.setRoutePlanner(SystemDefaultRoutePlanner(proxyProvider.proxySelector))
.setDefaultCredentialsProvider(SystemDefaultCredentialsProvider())
.setSSLHostnameVerifier { hostname, sslSession ->
peerCerts = sslSession.peerCertificates

Check warning on line 76 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L69-L76

Added lines #L69 - L76 were not covered by tests

verifierDelegate.verify(hostname, sslSession)

Check warning on line 78 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L78

Added line #L78 was not covered by tests
}
// prompt user via modal to accept certificate if needed; otherwise need to prompt separately prior to launching flare
.setSSLContext(CertificateManager.getInstance().sslContext)

Check warning on line 81 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L81

Added line #L81 was not covered by tests

// client request will fail if user did not accept cert
client.build().execute(RequestBuilder.options(uri).build())

Check warning on line 84 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L84

Added line #L84 was not covered by tests

val certificates = peerCerts as Array<X509Certificate>

Check warning on line 86 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L86

Added line #L86 was not covered by tests

// java default + custom system
// excluding leaf cert for case where user has both leaf and issuing CA as trusted roots
val allAccepted = CertificateManager.getInstance().trustManager.acceptedIssuers.toSet() - certificates.first()
val ks = keystoreFromCertificates(allAccepted)

Check warning on line 91 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L90-L91

Added lines #L90 - L91 were not covered by tests

// if this throws then there is a bug because it passed PKIX validation in apache client
val trustChain = try {
resolveTrustChain(certificates.toList(), ks)
} catch (e: Exception) {
LOG.warn(e) { "Passed Apache PKIX verification but could not build trust anchor via CertPathBuilder" }
emptyList()

Check warning on line 98 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L94-L98

Added lines #L94 - L98 were not covered by tests
}

// if trust chain is empty, then somehow user only trusts the leaf cert???
return trustChain.ifEmpty {
// so return the served certificate chain from the server and hope that works
certificates.toList()

Check warning on line 104 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L104

Added line #L104 was not covered by tests
}
}

private fun keystoreFromCertificates(certificates: Collection<X509Certificate>): KeyStore {
val ks = KeyStore.getInstance(KeyStore.getDefaultType())
ks.load(null, null)
certificates.forEachIndexed { index, cert ->
ks.setCertificateEntry(
cert.getSubjectX500Principal().toString() + "-" + DigestUtil.sha256Hex(cert.encoded),

Check notice on line 113 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Accessor call that can be replaced with property access syntax

Use of getter method instead of property access syntax
cert

Check warning on line 114 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L109-L114

Added lines #L109 - L114 were not covered by tests
)
}
return ks

Check warning on line 117 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/TrustChainUtil.kt#L116-L117

Added lines #L116 - L117 were not covered by tests
}
}
Loading