diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-11-08 12:37:03 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-11-08 12:37:03 -0500 |
| commit | ef4f212fc1482136dba1e690ec589b315b4a377f (patch) | |
| tree | 0b7e16d72567fafcfd3e08d7c5c591ad07a63458 /StoneIsland/plugins/cordova-plugin-whitelist/README.md | |
| parent | 5fa81da81260d65113f57a293b6256d334fe8e2d (diff) | |
build 0.7.0
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-whitelist/README.md')
| -rw-r--r--[-rwxr-xr-x] | StoneIsland/plugins/cordova-plugin-whitelist/README.md | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-whitelist/README.md b/StoneIsland/plugins/cordova-plugin-whitelist/README.md index def10044..e19d2304 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-whitelist/README.md +++ b/StoneIsland/plugins/cordova-plugin-whitelist/README.md @@ -1,30 +1,44 @@ -<!--- - license: Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. +--- +title: Whitelist +description: Whitelist external content accessible by your app. +--- +<!-- +# license: Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. --> # cordova-plugin-whitelist This plugin implements a whitelist policy for navigating the application webview on Cordova 4.0 +:warning: Report issues on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Whitelist%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC) + +## Installation + +You can install whitelist plugin with Cordova CLI, from npm: + +``` +$ cordova plugin add cordova-plugin-whitelist +$ cordova prepare +``` + ## Supported Cordova Platforms * Android 4.0.0 or above -* iOS 4.0.0 or above ## Navigation Whitelist Controls which URLs the WebView itself can be navigated to. Applies to @@ -32,15 +46,14 @@ top-level navigations only. Quirks: on Android it also applies to iframes for non-http(s) schemes. -By default, navigations only to `file://` URLs, are allowed. To allow other -other URLs, you must add `<allow-navigation>` tags to your `config.xml`: +By default, navigations only to `file://` URLs, are allowed. To allow others URLs, you must add `<allow-navigation>` tags to your `config.xml`: <!-- Allow links to example.com --> <allow-navigation href="http://example.com/*" /> <!-- Wildcards are allowed for the protocol, as a prefix to the host, or as a suffix to the path --> - <allow-havigation href="*://*.example.com/*" /> + <allow-navigation href="*://*.example.com/*" /> <!-- A wildcard can be used to whitelist the entire network, over HTTP and HTTPS. @@ -111,6 +124,9 @@ In `config.xml`, add `<access>` tags, like this: Without any `<access>` tags, only requests to `file://` URLs are allowed. However, the default Cordova application includes `<access origin="*">` by default. + +Note: Whitelist cannot block network redirects from a whitelisted remote website (i.e. http or https) to a non-whitelisted website. Use CSP rules to mitigate redirects to non-whitelisted websites for webviews that support CSP. + Quirk: Android also allows requests to https://ssl.gstatic.com/accessibility/javascript/android/ by default, since this is required for TalkBack to function properly. ### Content Security Policy @@ -131,13 +147,16 @@ Here are some example CSP declarations for your `.html` pages: --> <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *"> - <!-- Allow requests to foo.com --> + <!-- Allow everything but only from the same origin and foo.com --> <meta http-equiv="Content-Security-Policy" content="default-src 'self' foo.com"> - <!-- Enable all requests, inline styles, and eval() --> - <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src: 'self' 'unsafe-inline' 'unsafe-eval'"> + <!-- This policy allows everything (eg CSS, AJAX, object, frame, media, etc) except that + * CSS only from the same origin and inline styles, + * scripts only from the same origin and inline styles, and eval() + --> + <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> - <!-- Allow XHRs via https only --> + <!-- Allows XHRs only over HTTPS on the same domain. --> <meta http-equiv="Content-Security-Policy" content="default-src 'self' https:"> <!-- Allow iframe to https://cordova.apache.org/ --> |
