lapcat / SafariExtensions

Resources for the development of Safari extensions
43 stars 3 forks source link

FB12120432 - Safari extension website permissions don't apply to cross-origin iframes #36

Open lapcat opened 1 year ago

lapcat commented 1 year ago

The user can allow a Safari extension to access specific websites. However, these permissions don't apply to cross-origin iframes on the page. This is a major problem, because the user generally doesn't even know that a website is loading iframes, or the URLs of the iframes.

This bug occurs on both iOS and macOS. I tested with mobile and desktop Safari version 16.4.1. Attached is a sample Xcode project to demonstrate the bug. The extension manifest json declares "all_frames": true.

Steps to reproduce: 1) Unzip, open, build, and run the attached sample Xcode project "FrameBug" 2) Enable the extension in Safari 3) Open https://lapcatsoftware.com/articles/pip.html which contains an iframe with src https://www.youtube-nocookie.com/embed/ZrotkcWJFwo?controls=0&autoplay=1&start=33 4) Allow FrameBug to run on lapcatsoftware.com 5) Open the web inspector console

Expected results: There's a log message for both the top frame and the iframe.

Actual results: There's only a log message for the top frame.

The extension runs in the iframe only if the extension is given permission to access www.youtube-nocookie.com, or if it's given permission to access every website. FrameBug.zip