Skip to content

Document security considerations for HTML translation #78

Description

@reillyeon

In mozilla/standards-positions#1015 @jakearchibald raises a legitimate concern that developers will attempt to translate HTML fragments with code that amounts to,

element.innerHTML = await translator.translate(element.innerHTML);

This is dangerous because many translation models expect text and not HTML as input. Since HTML is text, treating the output of the translator as HTML risks introducing injection attacks where a maliciously crafted non-HTML input can result in valid HTML output.

While #60 discusses ways in which the API could be extended to officially support translating HTML fragments, the specification should also be amended to document this attack vector as a security consideration.

Activity

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

Metadata

Metadata

Assignees

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