Hello. I do know that Mozilla doesn’t like innerHTML and family (like insertAdjacentHTML) - but is this review fully automatic (i.e. if only these functions are in use, then the extension is rejected) or does a human being takes a look at it?
I’m asking because I believe what I want to do is safe and I want to know if I may do it.
So - I want to display a “box” (new div) when a user clicks an image with some of the modifier keys (like ctrl), with this image on it, and a few details - here is a simplified version of the code:
//"our" hardcoded string, not user input, just some styling
let containerStyle = `
position:absolute;z-index:1001;
left:100px; top:100px;
`;
// here, srcElement is the element being clicked
let imgSrc = srcElement.getAttribute('src');
// making the whole html
let html = `
<div style = '${containerStyle}'>
<img src = '${imgSrc}'>
</div>
`;
document.querySelector('body').insertAdjacentHTML ('beforeend', html);
Note, that this is a content script, i.e. this will be injected on the site being opened.
It’s safe, right? A malicious site owner can’t do any harm, as far as I understand, yes? I’m using here only this one attr - ‘src’.
It’s different from the typical hack:
let html = "<img src='x' onerror='alert(1)'>";
someElement.innerHTML = html; // shows the alert
So, may I use it (the first code snippet :)) or will this be automatically rejected?