Skip to content

Commit c76fcc3

Browse files
authored
Merge pull request #7558 from tsmithsz/fix-amazonq-proxy-certificates
fix(amazonq): Remove setSystemCertificates from proxyUtil
2 parents e94762b + 7a5cbd3 commit c76fcc3

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

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

Lines changed: 0 additions & 38 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
@@ -101,41 +98,6 @@ export class ProxyUtil {
10198
process.env.NODE_EXTRA_CA_CERTS = config.certificateAuthority
10299
process.env.AWS_CA_BUNDLE = config.certificateAuthority
103100
this.logger.debug(`Set certificate bundle path: ${config.certificateAuthority}`)
104-
} else {
105-
// Fallback to system certificates if no custom CA is configured
106-
await this.setSystemCertificates()
107-
}
108-
}
109-
110-
/**
111-
* Sets system certificates as fallback when no custom CA is configured
112-
*/
113-
private static async setSystemCertificates(): Promise<void> {
114-
try {
115-
const tls = await import('tls')
116-
// @ts-ignore Get system certificates
117-
const systemCerts = tls.getCACertificates('system')
118-
// @ts-ignore Get any existing extra certificates
119-
const extraCerts = tls.getCACertificates('extra')
120-
const allCerts = [...systemCerts, ...extraCerts]
121-
if (allCerts && allCerts.length > 0) {
122-
this.logger.debug(`Found ${allCerts.length} certificates in system's trust store`)
123-
124-
const tempDir = join(tmpdir(), 'aws-toolkit-vscode')
125-
if (!nodefs.existsSync(tempDir)) {
126-
nodefs.mkdirSync(tempDir, { recursive: true })
127-
}
128-
129-
const certPath = join(tempDir, 'vscode-ca-certs.pem')
130-
const certContent = allCerts.join('\n')
131-
132-
nodefs.writeFileSync(certPath, certContent)
133-
process.env.NODE_EXTRA_CA_CERTS = certPath
134-
process.env.AWS_CA_BUNDLE = certPath
135-
this.logger.debug(`Set system certificate bundle path: ${certPath}`)
136-
}
137-
} catch (err) {
138-
this.logger.error(`Failed to extract system certificates: ${err}`)
139101
}
140102
}
141103
}

0 commit comments

Comments
 (0)