# Compiler-generated add-on code: Unsafe assignment to innerHTML

**URL:** <https://discourse.mozilla.org/t/compiler-generated-add-on-code-unsafe-assignment-to-innerhtml/130291>\
**Category:** Development\
**Created:** [May 12, 2024, 1:39am UTC](https://discourse.mozilla.org/t/compiler-generated-add-on-code-unsafe-assignment-to-innerhtml/130291 "2024-05-12T01:39:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ausius](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@ausius](https://discourse.mozilla.org/u/ausius)\
**Post date:** [May 12, 2024, 1:39am UTC](https://discourse.mozilla.org/t/compiler-generated-add-on-code-unsafe-assignment-to-innerhtml/130291/1 "2024-05-12T01:39:36Z")

</div>

Hi, I used a frontend framework ([Svelte](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_getting_started)) to make an add-on. When I tried submitting my add-on, I got the warning, `Unsafe assignment to innerHTML.`

Do I have to address/fix the warning? If so, how can I do it, since Svelte compiled and generated the code for the add-on. Or do I not have to fix it because the add-on code was generated by Svelte?

I really appreciate any help anyone can provide. Thanks!

---

<div class="post-metadata">

**Author:** ![juraj.masiar](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/juraj.masiar/32/30587_2.png) [@juraj.masiar](https://discourse.mozilla.org/u/juraj.masiar)\
**Post date:** [May 12, 2024, 7:57am UTC](https://discourse.mozilla.org/t/compiler-generated-add-on-code-unsafe-assignment-to-innerhtml/130291/2 "2024-05-12T07:57:10Z")

</div>

I don’t think it’s fixable. It’s just how the framework works. I have the same issue with my Vue based addons, but no reviewer ever complained about those.

If I remember correctly, it’s also allowed if you can easily guarantee that the content is sanitized. I think the libraries should guarantee that, so it should be OK.

See also: [Element: innerHTML property - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations)

And some official discussion from few years back:

> [@"Unsafe assignment to innerHTML" with LinkeDOM](https://discourse.mozilla.org/t/unsafe-assignment-to-innerhtml-with-linkedom/108531):
>
> Hi, I am currently working on upgrading my extension [Cast Kodi](https://github.com/regseb/castkodi/tree/mv3/src) to MV3. The background must parse HTML, but DOMParser is not available in the service worker. So I use [LinkeDOM](https://github.com/WebReflection/linkedom/blob/c3a207b/worker.js) as polyfill. Addons-linter reports three warnings : Unsafe assignment to innerHTML. Do you think my extension will be accepted in [addons.mozilla.org](http://addons.mozilla.org)? The LinkeDOM library is only useful for Chromium, but I don’t want to manage two versions of my code (or develop a process to generate two versions).

---

<div class="post-metadata">

**Author:** ![ausius](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@ausius](https://discourse.mozilla.org/u/ausius)\
**Post date:** [May 12, 2024, 6:08pm UTC](https://discourse.mozilla.org/t/compiler-generated-add-on-code-unsafe-assignment-to-innerhtml/130291/3 "2024-05-12T18:08:40Z")

</div>

Ok, good to know and thanks a lot for clarifying!
