Skip to content

fix: add escape for ui - #411

Merged
SrinivasanTarget merged 1 commit into
mainfrom
escape
Jun 18, 2026
Merged

fix: add escape for ui#411
SrinivasanTarget merged 1 commit into
mainfrom
escape

Conversation

@KazuCocoa

@KazuCocoa KazuCocoa commented Jun 18, 2026

Copy link
Copy Markdown
Member

This PR is security fix.

  • Fix HTML escape
  • Fix onClick behavior

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the locator generator UI by preventing HTML/JS injection through untrusted locator metadata and selectors, and adds a regression test to ensure escaping is applied consistently.

Changes:

  • Escape element metadata (tagName/text/contentDesc/resourceId) and locator strategy/selector before rendering into HTML.
  • Replace inline onclick handler generation with data-* attributes + a delegated click listener.
  • Add Jest coverage to assert XSS payloads are escaped and inline event handlers are not emitted.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/ui/mcp-ui-utils.ts Escapes untrusted values in generated locator UI HTML and switches to delegated click handling for “Test” buttons.
src/tests/mcp-ui-utils.test.ts Adds regression test ensuring locator UI output escapes malicious content and removes inline handlers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/mcp-ui-utils.ts
@SrinivasanTarget
SrinivasanTarget merged commit e222bbb into main Jun 18, 2026
7 checks passed
@SrinivasanTarget
SrinivasanTarget deleted the escape branch June 18, 2026 06:39
github-actions Bot pushed a commit that referenced this pull request Jun 18, 2026
## [1.85.10](v1.85.9...v1.85.10) (2026-06-18)

### Bug Fixes

* add escape for ui ([#411](#411)) ([e222bbb](e222bbb))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.85.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants