-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(mcp): lax file path sanitization #37502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c9e0085
to
f0583b3
Compare
yury-s
reviewed
Sep 19, 2025
export function sanitizeForFilePath(outputDir: string, name: string) { | ||
const base = path.resolve(outputDir); | ||
// Fast path, permissive | ||
const lax = name.split(path.sep).map(s => s.replace(/[\x00-\x1F\x22\x2A\x2F\x3A\x3C\x3E\x3F\x5C\x7C\x7F]/g, '-').trim()).join(path.sep); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is a file name why does it have path.sep?
f0583b3
to
74fd214
Compare
yury-s
approved these changes
Sep 19, 2025
if (options.origin === 'llm') { | ||
const resolvedFile = path.resolve(outputDir, fileName); | ||
if (!resolvedFile.startsWith(path.resolve(outputDir) + path.sep)) | ||
throw new Error(`Resolved file path for ${fileName} is outside of the output directory`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include the directory name in the error message.
74fd214
to
a4bf3eb
Compare
renovate bot
added a commit
to izumin5210/dotfiles
that referenced
this pull request
Sep 28, 2025
Coming soon: The Renovate bot (GitHub App) will be renamed to Mend. PRs from Renovate will soon appear from 'Mend'. Learn more [here](https://redirect.github.com/renovatebot/renovate/discussions/37842). This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [@playwright/mcp](https://playwright.dev) ([source](https://redirect.github.com/microsoft/playwright-mcp)) | [`0.0.39` -> `0.0.40`](https://renovatebot.com/diffs/npm/@playwright%2fmcp/0.0.39/0.0.40) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>microsoft/playwright-mcp (@​playwright/mcp)</summary> ### [`v0.0.40`](https://redirect.github.com/microsoft/playwright-mcp/releases/tag/v0.0.40) [Compare Source](https://redirect.github.com/microsoft/playwright-mcp/compare/v0.0.39...v0.0.40) ##### Features - [microsoft/playwright@`c813e9c`](https://redirect.github.com/microsoft/playwright/commit/c813e9cf5) feat(mcp): allow saving videos for sessions [microsoft/playwright#37531](https://redirect.github.com/microsoft/playwright/issues/37531) ```bash ``` ### video is saved from the creation of the page to the closure of the context (browser\_close call). npx [@​playwright/mcp](https://redirect.github.com/playwright/mcp) --save-video=800x600 ```` - microsoft/playwright@fff065816 feat(mcp): add --init-script option microsoft/playwright#37507 ```bash ### the code in web-mocks.js will run on page initialization npx @​playwright/mcp --init-script=./web-mocks.js ```` - [microsoft/playwright@`1313fbd`](https://redirect.github.com/microsoft/playwright/commit/1313fbd47) chore(mcp): introduce allowed-hosts [microsoft/playwright#37541](https://redirect.github.com/microsoft/playwright/issues/37541) ```bash ``` ### Runs MCP server only accessible on 192.168.1.10, defense from DNS rebind npx [@​playwright/mcp](https://redirect.github.com/playwright/mcp) --allowed-hosts=192.168.1.10:8080 --port=8080 ``` ##### Bugfixes - microsoft/playwright@da333232e fix(mcp): snapshot for ai fixes microsoft/playwright#37527 - microsoft/playwright@499d084a5 fix(session): an extra check for session log microsoft/playwright#37508 - microsoft/playwright@2f820cb20 fix(mcp): lax file path sanitization microsoft/playwright#37502 ``` </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/izumin5210/dotfiles). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzAuMSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes microsoft/playwright-mcp#1063