Skip to content

Commit 7a5cbd3

Browse files
committed
fix(amazonq): Remove setSystemCertificates from proxyUtil
1 parent 0b76f7f commit 7a5cbd3

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

packages/core/src/shared/utilities/proxyUtil.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
import vscode from 'vscode'
77
import { getLogger } from '../logger/logger'
8-
import { tmpdir } from 'os'
9-
import { join } from 'path'
10-
import * as nodefs from 'fs' // eslint-disable-line no-restricted-imports
118

129
interface ProxyConfig {
1310
proxyUrl: string | undefined
@@ -73,9 +70,6 @@ export class ProxyUtil {
7370
// Always enable experimental proxy support for better handling of both explicit and transparent proxies
7471
process.env.EXPERIMENTAL_HTTP_PROXY_SUPPORT = 'true'
7572

76-
// Load built-in bundle and system OS trust store
77-
process.env.NODE_OPTIONS = '--use-system-ca'
78-
7973
const proxyUrl = config.proxyUrl
8074
// Set proxy environment variables
8175
if (proxyUrl) {
@@ -104,41 +98,6 @@ export class ProxyUtil {
10498
process.env.NODE_EXTRA_CA_CERTS = config.certificateAuthority
10599
process.env.AWS_CA_BUNDLE = config.certificateAuthority
106100
this.logger.debug(`Set certificate bundle path: ${config.certificateAuthority}`)
107-
} else {
108-
// Fallback to system certificates if no custom CA is configured
109-
await this.setSystemCertificates()
110-
}
111-
}
112-
113-
/**
114-
* Sets system certificates as fallback when no custom CA is configured
115-
*/
116-
private static async setSystemCertificates(): Promise<void> {
117-
try {
118-
const tls = await import('tls')
119-
// @ts-ignore Get system certificates
120-
const systemCerts = tls.getCACertificates('system')
121-
// @ts-ignore Get any existing extra certificates
122-
const extraCerts = tls.getCACertificates('extra')
123-
const allCerts = [...systemCerts, ...extraCerts]
124-
if (allCerts && allCerts.length > 0) {
125-
this.logger.debug(`Found ${allCerts.length} certificates in system's trust store`)
126-
127-
const tempDir = join(tmpdir(), 'aws-toolkit-vscode')
128-
if (!nodefs.existsSync(tempDir)) {
129-
nodefs.mkdirSync(tempDir, { recursive: true })
130-
}
131-
132-
const certPath = join(tempDir, 'vscode-ca-certs.pem')
133-
const certContent = allCerts.join('\n')
134-
135-
nodefs.writeFileSync(certPath, certContent)
136-
process.env.NODE_EXTRA_CA_CERTS = certPath
137-
process.env.AWS_CA_BUNDLE = certPath
138-
this.logger.debug(`Set system certificate bundle path: ${certPath}`)
139-
}
140-
} catch (err) {
141-
this.logger.error(`Failed to extract system certificates: ${err}`)
142101
}
143102
}
144103
}

0 commit comments

Comments
 (0)