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

Add filtering for custom URI schemata (e.g. mailto:, skype:) to the filterClickEvent to force these to open outside the sandbox #1260

Closed
Tracked by #1263
Jaifroid opened this issue Jun 3, 2024 · 2 comments · Fixed by #1264
Assignees
Labels
bug-non-critical For bugs that it would be nice to fix rather than critical to fix zimit Code relating to the support of Zimit-style archives
Milestone

Comments

@Jaifroid
Copy link
Member

Jaifroid commented Jun 3, 2024

It turns out that attempting to open a mailto: link in a Chromium extension (or in a PWA in Chromium browsers) is seen by Chrome as an insecure protocol, which triggers sandbox blocking. See kiwix/libkiwix#1138. In Zimit1, the ReplayWorker handled this kind of stuff, I think, but we may have to handle it ourselves. There's currently already such a filter in JQuery/Safe mode.

However, we should first try a simple fix by adding mailto: as an allowed protocol in the sandbox Content Security Policy.

@Jaifroid Jaifroid added bug-non-critical For bugs that it would be nice to fix rather than critical to fix zimit Code relating to the support of Zimit-style archives labels Jun 3, 2024
@Jaifroid Jaifroid added this to the v4.1 milestone Jun 3, 2024
@Jaifroid Jaifroid self-assigned this Jun 3, 2024
@Jaifroid
Copy link
Member Author

Jaifroid commented Jun 3, 2024

According to my tests, relaxing the CSP on the iframe by adding mailto: in the list of exceptions should do the job. In the PWA, I had to add this to the specific frame-src CSP list. See also kiwix/libkiwix#1090.

@Jaifroid Jaifroid changed the title Add filtering for mailto: links to the filterClickEvent or allow it in the sandbox CSP Add filtering for custom URI schemata (e.g. mailto:, skype:) to the filterClickEvent to force these to open outside the sandbox Jun 7, 2024
@Jaifroid
Copy link
Member Author

Jaifroid commented Jun 7, 2024

Having experimented with this in the PWA, I now think we should deal with all such cases generically. We will need to add exceptions for javascript: and about:, but I think everything else, e.g. ftp: (deprecated), blob:, data:, file:, and custom URIs such as zoomus:, skype:, etc. should just be dealt with in the same way: open a new window and let the browser deal with these as it sees fit.

We might add an exception also for data: images, though I'm not sure. Is it useful to open an image inside the iframe in this way (technically that isn't a problem)? Arguably more useful to have it in a separate tab or window, and then the user can right-click it, save it to disk, print it, etc, without the iframe getting in the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-non-critical For bugs that it would be nice to fix rather than critical to fix zimit Code relating to the support of Zimit-style archives
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant