InAppBrowser.com icon indicating copy to clipboard operation
InAppBrowser.com copied to clipboard

override EventTarget.prototype methods

Open bttmly opened this issue 3 years ago • 2 comments

First off, love the project – it is very much needed! I didn't see a way to open an issue nor contribution guidelines, I'm sure you're busy at the moment so feel free to disregard, reply to this whenever, or let me know if there's a better way than an unsolicited PR from someone on the Internet.

Anyway I noticed a malicious site can circumvent the override on window.addEventListener by doing EventTarget.prototype.addEventListener.call(window, eventName, handler). In this patch, instead the underlying prototype methods are overridden. To test, the following code will trip the potentially dangerous warning on this branch but not on master.

EventTarget.prototype.addEventListener.call(window, "keypress", (e) => { /* something fishy */ })

I'm only logging handlers on document and window but it adding document.body might be a good idea.

bttmly avatar Aug 19 '22 02:08 bttmly

Deploy Preview for inappbrowser ready!

Name Link
Latest commit 951eb85bf7004e9d0c5901925333f2fd3a69a342
Latest deploy log https://app.netlify.com/sites/inappbrowser/deploys/62fefad65871ab00098ab634
Deploy Preview https://deploy-preview-1--inappbrowser.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Aug 19 '22 02:08 netlify[bot]

Thank you @bttmly, yes, I have to respond to lots of incoming messages now, but will take a look at this as soon as I can. Thank you!

KrauseFx avatar Aug 19 '22 07:08 KrauseFx