Giter Site home page Giter Site logo

Comments (6)

mikesamuel avatar mikesamuel commented on July 27, 2024 8

lit-html works by building a DOM tree, so injection of whole script elements is not an issue, but there are others.

The known XSS risks are:

  • attacker controls value for the unsafeHTML directive; the string <img src=bogus onerror=alert(document.origin)> can inject code even though straightforward <script> injection fails.
  • attacker controls text in sensitive locations: html`<script>${ x }</script>`
  • attacker controls values for sensitive attributes like html`<iframe srcdoc=${ x }>` or html`<script src=${ x }></script>`
  • attacker controls values assigned to sensitive properties like html`<div .innerHTML=${ x }>`
  • attacker controls string that reaches event handlers like html`<button @onclick=${ x }>`
  • attacker controls CSS which in other contexts has leaked information about page content.

The team is aware of those risks and is working on addressing them.

from lit.dev.

lastmjs avatar lastmjs commented on July 27, 2024 2

Is there any official documentation on the security/threat model of lit-html? I feel this is very important information and would be very useful to include as a section on the official website: https://lit-html.polymer-project.org

from lit.dev.

mikesamuel avatar mikesamuel commented on July 27, 2024 1

@lastmjs https://github.com/Polymer/polymer-resin#readme captures my threat modelling when I wrote resin. I don't speak for the Polymer project though.

from lit.dev.

interactiveRob avatar interactiveRob commented on July 27, 2024

@mikesamuel Thanks for this info!

from lit.dev.

mikesamuel avatar mikesamuel commented on July 27, 2024

On diving deeper, it turns out html`<button @onclick=${ x }>` is not problematic.

Will edit my summary.

from lit.dev.

leonheess avatar leonheess commented on July 27, 2024

What's the status of this?

from lit.dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.