Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Content script is not injected into elements loaded in <object> tag #1769

Closed
AdamWr opened this issue Jun 7, 2023 · 4 comments
Closed

Content script is not injected into elements loaded in <object> tag #1769

AdamWr opened this issue Jun 7, 2023 · 4 comments

Comments

@AdamWr
Copy link
Member

AdamWr commented Jun 7, 2023

Steps to reproduce:

  1. Add these rules:
youtube.com##body
youtube.com#%#alert(1);
  1. Navigate to - https://example.org/
  2. In browser console run:
(() => {
  const video = '<object data="https://www.youtube.com/embed/YW9Ojcm1Gkg" style="height: 300px; width: 600px;"></object>';
  const createDiv = document.createElement("div");
  document.body.appendChild(createDiv);
  createDiv.innerHTML = video;
})();

Actual behavior

It looks like that request is detected as a media type (though I'm not sure if it's the reason of not applying rules) and rules are not applied.

Screenshots

image

image

image

Expected behavior

Rules should be applied - website in the object tag should be blank and there should be message 1.

AdGuard for Windows 7.13 nightly 16 (build 4279, CL 1.11.111)

@ameshkov
Copy link
Member

ameshkov commented Jun 9, 2023

Hmm, interesting, I didn't know object could be used as an iframe.

@sfionov sounds like a legit bug to me, but should be handled carefully.

@sfionov
Copy link
Member

sfionov commented Jun 9, 2023

Yeah, and browser sends Sec-Fetch-Dest: object in this case, but it sends it also when object is not iframe-like.

@ameshkov
Copy link
Member

ameshkov commented Jun 9, 2023

We could check the content-type header additionally in the case of sec-fetch-dest: object. Looks a bit clunky but what else we can do.

@AdamWr are there many examples where this kind of objects are actually used?

@AdamWr
Copy link
Member Author

AdamWr commented Jun 9, 2023

I'm not aware of any reports (reported by users) with mentioned issue, but I noticed this problem in this case - AdguardTeam/AdguardFilters#152618

There is a video player in some offers, for example here - https://www.evium.de/carmarket/details/4fbb8fe5-e1e4-4c14-8b1c-ae4386058a2c and ad markers are not hidden in the youtube video player, because cosmetic rules are not applied.

Screenshot

image

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

No branches or pull requests

6 participants