From 8af2e4db71c0138985c5b88b3826e8facfbc8b2a Mon Sep 17 00:00:00 2001 From: ParakhJaggi Date: Thu, 5 Mar 2026 11:24:09 -0500 Subject: [PATCH] fix(teeny-request): update http-proxy-agent from ^5.0.0 to ^7.0.0 `http-proxy-agent@5.x` depends on `@tootallnate/once@2.x` which has a vulnerability (CVE-2026-3449) causing promises to hang indefinitely when AbortSignal is used. `http-proxy-agent@7.x` drops this dependency. - Update `http-proxy-agent` from `^5.0.0` to `^7.0.0` - Use named exports (`HttpProxyAgent`/`HttpsProxyAgent`) and new constructor signature `(proxy, opts)` per v7 API - Remove unused `import {parse} from 'url'` - Update test assertion for port type (string in v7 URL objects) --- packages/teeny-request/package.json | 2 +- packages/teeny-request/src/agents.ts | 17 ++++------------- packages/teeny-request/test/agents.ts | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/teeny-request/package.json b/packages/teeny-request/package.json index 0cf9dff35..d69d64ebd 100644 --- a/packages/teeny-request/package.json +++ b/packages/teeny-request/package.json @@ -42,7 +42,7 @@ }, "homepage": "https://github.com/googleapis/google-cloud-node-core/tree/main/packages/teeny-request", "dependencies": { - "http-proxy-agent": "^5.0.0", + "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", "node-fetch": "^3.3.2", "stream-events": "^1.0.5" diff --git a/packages/teeny-request/src/agents.ts b/packages/teeny-request/src/agents.ts index 2cb72c1d0..bf27f8437 100644 --- a/packages/teeny-request/src/agents.ts +++ b/packages/teeny-request/src/agents.ts @@ -17,8 +17,6 @@ import {Agent as HTTPAgent} from 'http'; import {Agent as HTTPSAgent} from 'https'; -// eslint-disable-next-line n/no-deprecated-api -import {parse} from 'url'; import {Options} from './'; export const pool = new Map(); @@ -83,18 +81,11 @@ export function getAgent( if (proxy && shouldUseProxy) { // tslint:disable-next-line variable-name - let Agent = isHttp - ? require('http-proxy-agent') - : require('https-proxy-agent'); - - if (Agent.HttpsProxyAgent) { - Agent = Agent.HttpsProxyAgent; - } else if (Agent.HttpProxyAgent) { - Agent = Agent.HttpProxyAgent; - } + const {HttpProxyAgent} = require('http-proxy-agent'); + const {HttpsProxyAgent} = require('https-proxy-agent'); - const proxyOpts = {...parse(proxy), ...poolOptions}; - return new Agent(proxyOpts); + const Agent = isHttp ? HttpProxyAgent : HttpsProxyAgent; + return new Agent(proxy, poolOptions); } let key = isHttp ? 'http' : 'https'; diff --git a/packages/teeny-request/test/agents.ts b/packages/teeny-request/test/agents.ts index 755ddc268..0f8deee0e 100644 --- a/packages/teeny-request/test/agents.ts +++ b/packages/teeny-request/test/agents.ts @@ -67,7 +67,7 @@ describe('agents', () => { const proxy = 'http://hello.there:8080'; const proxyExpected = { hostname: 'hello.there', - port: 8080, + port: '8080', protocol: 'http:', };