fix(examples/chrome-applescript): sanitize tab_id to prevent AppleScr… · modelcontextprotocol/mcpb@dace08d · GitHub
Skip to content

Commit dace08d

Browse files
fix(examples/chrome-applescript): sanitize tab_id to prevent AppleScript injection
The inputSchema `type: "number"` is advisory only — runtime may receive a string payload that gets interpolated into the osascript template. Coerce tab_id via Number.parseInt before interpolating at all four sites. Affected sites: - findTabById(tabId) - executeTabOperation(tabId, ...) (close_tab, switch_to_tab, reload_tab, go_back, go_forward) - execute_javascript handler - get_page_content handler The shared toSafeTabId() helper returns null for missing values (preserving the active-tab fallthrough) and throws on non-numeric input (surfacing misuse via the existing request-level try/catch, consistent with the missing-code path in execute_javascript).
1 parent a3a6624 commit dace08d

1 file changed

Lines changed: 32 additions & 11 deletions

File tree

  • examples/chrome-applescript/server

‎examples/chrome-applescript/server/index.js‎

Lines changed: 32 additions & 11 deletions

0 commit comments

Comments
 (0)