Merge pull request #1299 from morluto/fix/schema-patterns-without-lookaround

fix(mcp): advertise input patterns without look-around
This commit is contained in:
Kaoru0822
2026-10-09 07:58:51 -07:00
committed by GitHub
4 changed files with 113 additions and 3 deletions
+6 -2
View File
@@ -19,9 +19,13 @@ import {
deriveFindings,
} from "./dylibResolutionFindings.js";
/** Normalized path below the analyzed root: no `.`/`..` or empty segments. */
/**
* Normalized path below the analyzed root: nonempty segments joined by single
* `/`, none of them `.` or `..`, without backslash or NUL. Advertised schema
* patterns avoid look-around, which RE2 and Rust validators reject.
*/
const ROOT_RELATIVE_PATH =
/^(?!\/)(?!(?:.*\/)?\.{1,2}(?:\/|$))(?!.*\/\/)(?!.*\/$)[^\\\u0000]+$/u;
/^(?:[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.\.[^\x2f\\\u0000]+)(?:\x2f(?:[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.[^\x2f\\\u0000.][^\x2f\\\u0000]*|\.\.[^\x2f\\\u0000]+))*$/u;
const rootRelativePathSchema = z
.string()
.min(1)