by forgotmypw17 · 1w ago · 0 comments
>However, you should not consider this a strong security mechanism, because there are ways it can be evaded, for example by browser extensions running in the page. It's more of an indication that the page should not access the internals of your shadow DOM tree.
https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...
This presentation talks about using window.find() and other methods:
https://speakerdeck.com/masatokinugawa/shadow-dom-and-securi...
2. Extensions can do whatever the user lets them. A web page however can not access a content script closed shadow root
3. Prototype pollution also cannot occur since content scripts run before the page
4. Window.find() also does not work if you run the content script in an isolated world, as you should.
If you do all of the above, a web page cannot access data from your content script closed shadow root.
Browser extensions can. Running untrusted browser extensions is extremely dangerous.
But content scripts? Yes. Browser extensions can call shadowDom openOrClose to read all shadow dom nodes