Skip to content

mXSS: should createHTML get information about the context? #569

@mozfreddyb

Description

@mozfreddyb

From my understanding, a lot of mXSS is caused by additional parsing:

With Trusted Types, additional parsing is basically impossible to avoid, because

  • user calls innerHTML
  • browser calls createHTML
  • createHTML uses a sanitizer (parses, sanitizes and serializes to a string)
  • return value of createHTML is being parsed again by innerHTML

I think we could make mXSS easier to avoid if the createHTML function gets optional arguments about the parsing context (an element? or an element name?).

CCing some folks since I am not sure if they watch the repo 🙂 @annevk, @koto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions