Skip to content

Conversation

@mannix-lei
Copy link

What

Implemented a data masking filter to protect sensitive user information before sending DOM data to the LLM.

  • Added maskSensitiveData utility function in src/dom/index.ts.
  • Integrated masking into flatTreeToString to sanitize:
    • HTML attribute values
    • Interactive element text content
    • Plain text nodes
  • Supported patterns:
    • Mobile phone numbers (CN)
    • Email addresses
    • ID card numbers (CN)
    • Bank card numbers

Type

  • Bug fix
  • Feature / Improvement
  • Refactor
  • Documentation
  • Website
  • Demo / Testing
  • Breaking change

Testing

  • Tested in modern browsers
  • No console errors
  • Types/doc added

Closes #(issue)

Requirements / 要求

What

Implemented a data masking filter to protect sensitive user information before sending DOM data to the LLM.

  • Added maskSensitiveData utility function in src/dom/index.ts.
  • Integrated masking into flatTreeToString to sanitize:
    • HTML attribute values
    • Interactive element text content
    • Plain text nodes
  • Supported patterns:
    • Mobile phone numbers (CN)
    • Email addresses
    • ID card numbers (CN)
    • Bank card numbers

Type

  • Bug fix
  • Feature / Improvement
  • Refactor
  • Documentation
  • Website
  • Demo / Testing
  • Breaking change

Testing

  • Tested in modern browsers
  • No console errors
  • Types/doc added

Closes #(issue)

Requirements / 要求

@CLAassistant
Copy link

CLAassistant commented Dec 2, 2025

CLA assistant check
All committers have signed the CLA.

@mannix-lei mannix-lei closed this Dec 3, 2025
@mannix-lei mannix-lei reopened this Dec 3, 2025
@gaomeng1900
Copy link
Collaborator

Thanks so much for taking the time to contribute! 🙌

I just merged a refactor that moves the DOM module into a separate package (@page-agent/page-controller), which unfortunately will cause some merge conflicts with your PR.

Also, I think it's better to keep data-masking rules out of the core lib and make it configurable.

I'll set up a PR soon to add a configurable data masking API. Once that's in, it'd be super helpful if you could add your rules as an example in the document page.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants