whisthq / whist

Whist Browser
https://whist.com
Apache License 2.0
6 stars 3 forks source link

Redirect blocklisted URLs to cloud tab #7511

Closed sardination closed 1 year ago

sardination commented 1 year ago

Ticket(s) Closed

N/A

Description

If a top-level navigation to an http:// or https:// URL is blocked by administrator (blocklisted), then we navigate to the equivalent cloud: URL.

NOTE: the admin dashboard implementation should automatically add cloud: URLs to the URLWhitelist policy. This should be a default and un-editable policy, at least until we add the implementation for pages that can be blocked on cloud as well. This is because a URLBlacklist policy of * will also block cloud: URLs and mess everything up. ((This is probably relevant to @mingy98 and maybe @owenniles for admin dashboard creation))

Implementation

Use the chrome.webNavigation API to detect when an error by administrator blockage occurs and then navigate to the cloud URL.

Documentation & Tests Added

N/A

Testing Instructions

Create a dummy policy at /Library/Managed Preferences/<username>/com.whisttechnologies.whist.development.plist and fill it with

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>URLAllowlist</key>
    <array>
        <string>cloud:*</string>
        <string>wikipedia.org</string>
    </array>
    <key>URLBlocklist</key>
    <array>
        <string>*</string>
    </array>
</dict>
</plist>

This dummy policy blocks all URLs except for those starting with cloud: and wikipedia.org. If you navigate to any blocked website (anything other than wikipedia.org), it should redirect to a cloud URL.

PR Checklist