Skip to content

Sanitize plugin transform HTML by default and document trusted opt-out - #24

Draft
RA9 with Copilot wants to merge 5 commits into
masterfrom
copilot/ra9-ezytables-7-document-xss
Draft

Sanitize plugin transform HTML by default and document trusted opt-out#24
RA9 with Copilot wants to merge 5 commits into
masterfrom
copilot/ra9-ezytables-7-document-xss

Conversation

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Plugin transform() results were written directly to innerHTML, creating an XSS path when plugin output included untrusted HTML. This change makes plugin HTML sanitization the default behavior and documents the explicit opt-out for trusted renderers.

  • API

    • Adds sanitize?: boolean to EzyTablesOptions
    • Defaults sanitize to true
    • Preserves existing raw HTML behavior behind sanitize: false for trusted plugin output
  • Plugin HTML handling

    • Sanitizes plugin transform() output before assigning it to innerHTML
    • Removes dangerous container tags such as script, iframe, object, embed, link, meta, style, and base
    • Strips inline event/style attributes and unsafe URL-bearing attributes
    • Uses a safe URL allowlist for sanitized plugin markup
  • Documentation

    • Calls out that plugin transforms render as HTML, not text
    • Documents the new sanitize option and when to disable it
    • Updates README and site docs/examples to reflect the safer default
  • Coverage

    • Adds focused tests for default sanitization and the trusted sanitize: false path
const table = new EzyTables({
  target: "#myTable",
  data: myData,
  plugins: [badgePlugin],
  sanitize: true, // default
});

// Opt out only for fully trusted HTML
const trustedTable = new EzyTables({
  target: "#myTable",
  data: myData,
  plugins: [trustedHtmlPlugin],
  sanitize: false,
});

Copilot AI changed the title [WIP] Document and mitigate XSS risk from plugin innerHTML output Sanitize plugin transform HTML by default and document trusted opt-out Jul 18, 2026
Copilot finished work on behalf of RA9 July 18, 2026 13:22
Copilot AI requested a review from RA9 July 18, 2026 13:22
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.

Document and mitigate XSS risk from plugin transform innerHTML output

2 participants