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

LGTM.com - false positive - js/unvalidated-message-origin wrongly detects window.chrome.webview.addEventListener('message' ... #9541

Open
TimBarham opened this issue Jun 14, 2022 · 1 comment
Assignees

Comments

@TimBarham
Copy link

@TimBarham TimBarham commented Jun 14, 2022

Description of the false positive

Microsoft's webview2 provides a window.chrome.webview object which supports a "message" event for receiving messages from the host application. This is not the same as the window "message" event, and the event object doesn't support an origin property, but js/unvalidated-message-origin wrongly flags it.

URL to the alert on the project page on LGTM.com

This alert is not in a project that's on LGTM.com.

@hmakholm hmakholm added the JS label Jun 14, 2022
@asgerf asgerf self-assigned this Jun 16, 2022
@asgerf
Copy link
Contributor

@asgerf asgerf commented Jun 17, 2022

Hi 👋

I can't quite reproduce the problem. When I scan the code below, I don't get any alerts from js/unvalidated-message-origin:

window.chrome.webview.addEventListener('message', event => {
    eval(event.data); // OK - not a cross-origin request
});

Could you create a small example that demonstrates the problem? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants