Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape html, when values are not stream like #7

Open
lorenzofox3 opened this issue Mar 27, 2024 · 0 comments · May be fixed by #14
Open

Escape html, when values are not stream like #7

lorenzofox3 opened this issue Mar 27, 2024 · 0 comments · May be fixed by #14

Comments

@lorenzofox3
Copy link

if I take the simple example:

function MyComponent({foo, title, baz, qux, bool}) {
  return html`
    <h1>${title}</h1>
    <div>${foo}</div>
    <div>${baz} ${qux}</div>
    <div>${bool}</div>
  `;
}

I have noticed that if I set foo (or whatever) as an html string like <script>window.alert('pwned')</script> the script is executed.

It would be nice if the templating library could escape this sort of value so I don't need to do it ahead (especially on environment like a nodejs server), don't you think ?

@thepassle thepassle linked a pull request Jan 14, 2025 that will close this issue
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 a pull request may close this issue.

1 participant