|
4 | 4 |
|
5 | 5 | - [SSL public key pinning](#ssl-pinning) |
6 | 6 | - [Certificate transparency](#certificate-transparency) |
7 | | -- [🚧 "Recent screenshots" prevention](#recent-screenshots-prevention) |
| 7 | +- [Prevent "recent screenshots"](#prevent-recent-screenshots) |
8 | 8 |
|
9 | 9 | > **⚠️ Disclaimer**<br/> |
10 | 10 | > This package is intended to help implement a few basic security features but does not in itself guarantee that an app is secure.<br/> |
@@ -32,6 +32,10 @@ Add the config plugin to `app.config.ts` / `app.config.js` / `app.json`: |
32 | 32 | "TQEtdMbmwFgYUifM4LDF+xgEtd0z69mPGmkp014d6ZY=", |
33 | 33 | "rFjc3wG7lTZe43zeYTvPq8k4xdDEutCmIhI5dn4oCeE=" |
34 | 34 | ] |
| 35 | + }, |
| 36 | + "preventRecentScreenshots": { |
| 37 | + "ios": { "enabled": true }, |
| 38 | + "android": { "enabled": true } |
35 | 39 | } |
36 | 40 | } |
37 | 41 | ] |
@@ -93,9 +97,29 @@ To test that SSL pinning is working as expected, you can: |
93 | 97 |
|
94 | 98 | None, enabled by default. |
95 | 99 |
|
96 | | -## "Recent screenshots" prevention |
| 100 | +## Prevent "recent screenshots" |
97 | 101 |
|
98 | | -TODO |
| 102 | +> **🥷 What's the threat?** When the OS terminates the app, it may take a screenshot and store it on the device to display in the app switcher. This screenshot could leak sensitive data |
| 103 | +
|
| 104 | +Mitigating this threat is achieved by: |
| 105 | + |
| 106 | +- Using [`FLAG_SECURE`](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_SECURE) on Android < 13 |
| 107 | +- Using [`Activity.setRecentScreenshotsEnabled`](<https://developer.android.com/reference/android/app/Activity#setRecentsScreenshotEnabled(boolean)>) on Android >= 13 |
| 108 | +- Covering the app with the splashscreen on iOS (requires [expo-splash-screen](https://docs.expo.dev/versions/latest/sdk/splash-screen/) to be setup) |
| 109 | + |
| 110 | +### Configuration |
| 111 | + |
| 112 | +```jsonc |
| 113 | +[ |
| 114 | + "@bam.tech/react-native-app-security", |
| 115 | + { |
| 116 | + "preventRecentScreenshots": { |
| 117 | + "ios": { "enabled": true }, |
| 118 | + "android": { "enabled": true } |
| 119 | + } |
| 120 | + } |
| 121 | +] |
| 122 | +``` |
99 | 123 |
|
100 | 124 | # Contributing |
101 | 125 |
|
|
0 commit comments