Skip to content

Commit 61d261e

Browse files
committed
test: subrequest vuln test is not applicable to node middleware
1 parent e974d7f commit 61d261e

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

tests/e2e/edge-middleware.test.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -469,22 +469,6 @@ for (const { expectedRuntime, label, testWithSwitchableMiddlewareRuntime } of [
469469
})
470470

471471
if (expectedRuntime !== 'node') {
472-
test("requests with x-middleware-subrequest don't skip middleware (GHSA-f82v-jwr5-mffw)", async ({
473-
middlewareSubrequestVuln,
474-
}) => {
475-
const response = await fetch(`${middlewareSubrequestVuln.url}`, {
476-
headers: {
477-
'x-middleware-subrequest': 'middleware:middleware:middleware:middleware:middleware',
478-
},
479-
})
480-
481-
// middleware was not skipped
482-
expect(response.headers.get('x-test-used-middleware')).toBe('true')
483-
484-
// ensure we are testing version before the fix for self hosted
485-
expect(response.headers.get('x-test-used-next-version')).toBe('15.2.2')
486-
})
487-
488472
test('requests with different encoding than matcher match anyway', async ({
489473
middlewareStaticAssetMatcher,
490474
}) => {
@@ -568,3 +552,20 @@ for (const { expectedRuntime, label, testWithSwitchableMiddlewareRuntime } of [
568552
})
569553
})
570554
}
555+
556+
// this test is using pinned next version that doesn't support node middleware
557+
test("requests with x-middleware-subrequest don't skip middleware (GHSA-f82v-jwr5-mffw)", async ({
558+
middlewareSubrequestVuln,
559+
}) => {
560+
const response = await fetch(`${middlewareSubrequestVuln.url}`, {
561+
headers: {
562+
'x-middleware-subrequest': 'middleware:middleware:middleware:middleware:middleware',
563+
},
564+
})
565+
566+
// middleware was not skipped
567+
expect(response.headers.get('x-test-used-middleware')).toBe('true')
568+
569+
// ensure we are testing version before the fix for self hosted
570+
expect(response.headers.get('x-test-used-next-version')).toBe('15.2.2')
571+
})

0 commit comments

Comments
 (0)