Compare commits
2
Commits
f46f54d50b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87475e60d0 | ||
|
|
3be9135aee |
@@ -41,8 +41,11 @@ export async function GET(
|
|||||||
ctx: { params: Promise<{ path: string[] }> },
|
ctx: { params: Promise<{ path: string[] }> },
|
||||||
): Promise<NextResponse> {
|
): Promise<NextResponse> {
|
||||||
const { path } = await ctx.params;
|
const { path } = await ctx.params;
|
||||||
// Segments arrive already percent-decoded and never empty, but join and
|
// Next splits the matched suffix on literal `/` and only then decodes each
|
||||||
// compare on the same normalized form the allowlist is written in.
|
// piece, so a segment can be empty (`api//mcp` -> ["api","","mcp"]) and a
|
||||||
|
// single segment can itself contain a decoded slash (`api%2Fmcp` -> one
|
||||||
|
// element, "api/mcp"). Join and compare on the same normalized form the
|
||||||
|
// allowlist is written in, and let anything else fail closed.
|
||||||
const resourcePath = path.join("/");
|
const resourcePath = path.join("/");
|
||||||
|
|
||||||
if (!METADATA_RESOURCE_PATHS.has(resourcePath)) {
|
if (!METADATA_RESOURCE_PATHS.has(resourcePath)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user