Skip to content

Commit 7a3ffeb

Browse files
authored
chore(frontend): upgrade http-proxy-middleware to fix CVE-2024-21536 (#12300)
* upgrade http-proxy-middleware Signed-off-by: Anay Sharma <[email protected]> * form data fix Signed-off-by: Anay Sharma <[email protected]> * form-data fix Signed-off-by: Anay Sharma <[email protected]> * upgrade typescript to handle new http-proxy-middleware version Signed-off-by: Anay Sharma <[email protected]> * regenerate lock files Signed-off-by: Anay Sharma <[email protected]> --------- Signed-off-by: Anay Sharma <[email protected]>
1 parent 9a8edfa commit 7a3ffeb

File tree

13 files changed

+516
-3725
lines changed

13 files changed

+516
-3725
lines changed

frontend/mock-backend/mock-api-server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import express from 'express';
16-
import proxy from 'http-proxy-middleware';
16+
import { createProxyMiddleware } from 'http-proxy-middleware';
1717
import mockApiMiddleware from './mock-api-middleware';
1818

1919
const app = express();
@@ -38,14 +38,14 @@ export const HACK_FIX_HPM_PARTIAL_RESPONSE_HEADERS = {
3838
/** Proxy metadata requests to the Envoy instance which will handle routing to the metadata gRPC server */
3939
app.all(
4040
'/ml_metadata.*',
41-
proxy({
41+
createProxyMiddleware({
4242
changeOrigin: true,
4343
onProxyReq: proxyReq => {
4444
console.log('Metadata proxied request: ', (proxyReq as any).path);
4545
},
4646
headers: HACK_FIX_HPM_PARTIAL_RESPONSE_HEADERS,
4747
target: getAddress({ host: 'localhost', port: '9090' }),
48-
}),
48+
}) as any,
4949
);
5050

5151
mockApiMiddleware(app as any);

frontend/mock-backend/proxy-middleware.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import * as express from 'express';
16-
import proxy from 'http-proxy-middleware';
16+
import { createProxyMiddleware } from 'http-proxy-middleware';
1717
import { URL, URLSearchParams } from 'url';
1818

1919
export function _extractUrlFromReferer(proxyPrefix: string, referer = ''): string {
@@ -68,7 +68,7 @@ export default (app: express.Application, apisPrefix: string) => {
6868

6969
app.all(
7070
proxyPrefix + '*',
71-
proxy({
71+
createProxyMiddleware({
7272
changeOrigin: true,
7373
logLevel: 'debug',
7474
target: 'http://127.0.0.1',
@@ -80,6 +80,6 @@ export default (app: express.Application, apisPrefix: string) => {
8080
pathRewrite: (_: any, req: any) => {
8181
return _rewritePath(proxyPrefix, req.path, req.query);
8282
},
83-
}),
83+
}) as any,
8484
);
8585
};

0 commit comments

Comments
 (0)