2 ms·
The vulnerability can be understood through this code snippet: const subreq = params.request.headers['x-middleware-subrequest']; const subrequests = typeof
by simonw 2y ago
The vulnerability can be understood through this code snippet:
const subreq = params.request.headers['x-middleware-subrequest'];
const subrequests = typeof subreq === 'string' ? subreq.split(':') : [];
// ...
for (const middleware of this.middleware || []) {
// ...
if (subrequests.includes(middlewareInfo.name)) {
result = {
response: NextResponse.next(),
waitUntil: Promise.resolve(),
};
continue;
}
}
Pass an x-middleware-subrequest HTTP header with a colon-separated list of middleware names to skip.
https://github.com/vercel/next.js/blob/v12.0.7/packages/next/server/next-server.ts#L686 https://github.com/vercel/next.js/blob/v12.0.7/packages/next...
- solid_fuel 2y agoWhat would this feature ever be used for? I'm surprised such a thing exists, instead of simply defining a different set of routes for a different set of middleware