|
4 | 4 | <qhelp> |
5 | 5 | <overview> |
6 | 6 | <p> |
7 | | - File access in an Android WebView can expose the device's file system to |
8 | | - the JavaScript running in the WebView. If there are vulnerabilities in the |
9 | | - JavaScript or untrusted content is loaded in the WebView, file access may |
10 | | - allow an attacker to access or steal the user's data. |
| 7 | + Allowing file access in an Android WebView can expose a device's file system to |
| 8 | + the JavaScript running in that WebView. If the JavaScript contains |
| 9 | + vulnerabilities or the WebView loads untrusted content, file access |
| 10 | + allows an attacker to steal the user's data. |
11 | 11 | </p> |
12 | 12 | </overview> |
13 | 13 |
|
14 | 14 | <recommendation> |
15 | | - <p>When possible, you should not allow file access. The file access settings |
16 | | - are disabled by default. You can explicitly disbale them by setting the |
| 15 | + <p>When possible, do not allow file access. The file access settings |
| 16 | + are disabled by default. You can explicitly disable file access by setting the |
17 | 17 | following settings to <code>false</code>:</p> |
18 | 18 |
|
19 | 19 | <ul> |
|
23 | 23 | </ul> |
24 | 24 |
|
25 | 25 | <p>If your application requires access to the file system, it is best to |
26 | | - avoid using <code>file://</code> urls, and instead use an alternative that |
27 | | - allows loading files via https, such |
| 26 | + avoid using <code>file://</code> URLs. Instead, use an alternative that |
| 27 | + loads files via HTTPS, such |
28 | 28 | as <code>androidx.webkit.WebViewAssetLoader</code>.</p> |
29 | 29 | </recommendation> |
30 | 30 |
|
31 | 31 | <example> |
32 | | - <p>In the following (bad) example, the WebView is configured with the settings |
33 | | - which would allow local file access.</p> |
| 32 | + <p>In the following (bad) example, the WebView is configured with settings |
| 33 | + that allow local file access.</p> |
34 | 34 |
|
35 | 35 | <sample src="WebViewFileAccessUnsafe.java"/> |
36 | 36 |
|
|
39 | 39 | <sample src="WebViewFileAccessSafe.java"/> |
40 | 40 |
|
41 | 41 | <p> |
42 | | - In the following example, an asset loader is configured so that assets can |
43 | | - be access over <code>https</code>, and not require file system access. |
| 42 | + As mentioned previously, asset loaders can load files without file system |
| 43 | + access. In the following (good) example, an asset loader is configured to |
| 44 | + load assets over HTTPS. |
44 | 45 | </p> |
45 | 46 |
|
46 | 47 | <sample src="AssetLoaderExample.java"/> |
|
0 commit comments