|
14 | 14 | - [Prevent "recent screenshots"](#prevent-recent-screenshots)
|
15 | 15 | - [Configuration](#configuration-2)
|
16 | 16 | - [Safe Keyboard Detector](#safe-keyboard-detector)
|
| 17 | + - [[EXPERIMENTAL - iOS only] Disable Default Caching in `Cache.db`](#experimental---ios-only-disable-default-caching-in-cachedb) |
17 | 18 | - [Contributing](#contributing)
|
18 | 19 | - [👉 About BAM](#-about-bam)
|
19 | 20 |
|
@@ -182,6 +183,39 @@ if (!isInDefaultSafeList) {
|
182 | 183 | SafeKeyboardDetector.showInputMethodPicker(); // can only be called on Android
|
183 | 184 | ```
|
184 | 185 |
|
| 186 | +## [EXPERIMENTAL - iOS only] Disable Default Caching in `Cache.db` |
| 187 | +> ⚠️ **DISCLAIMER:** This experimental feature may impact app behavior. Use it at your own risk. Disabling caching can cause unexpected issues. |
| 188 | +> |
| 189 | +> **Possible side effects:** |
| 190 | +> - Slower performance due to lack of cached responses |
| 191 | +> - Higher network usage from repeated requests |
| 192 | +> - Crashes in components expecting cached data |
| 193 | +> - Features failing in offline mode |
| 194 | +
|
| 195 | +> **🥷 Threat:** On iOS, every `NSURL` request may be cached by default in `Cache.db`, potentially storing sensitive data unless explicitly disabled. This can lead to unintentional data leaks. |
| 196 | +
|
| 197 | +Mitigating this threat is achieved by: |
| 198 | + |
| 199 | +- Fully clearing the existing cache |
| 200 | +- Remove the cache by setting it to an empty cache: |
| 201 | + |
| 202 | +```swift |
| 203 | +URLCache.shared = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil) |
| 204 | +``` |
| 205 | +### Configuration |
| 206 | +If you want to enable this functionality, it need to be enabled in the app configuration file (by default it's disabled) |
| 207 | + |
| 208 | +```jsonc |
| 209 | +[ |
| 210 | + "@bam.tech/react-native-app-security", |
| 211 | + { |
| 212 | + "disableCache": { |
| 213 | + "ios": { "enabled": true }, |
| 214 | + } |
| 215 | + } |
| 216 | +] |
| 217 | +``` |
| 218 | + |
185 | 219 | # Contributing
|
186 | 220 |
|
187 | 221 | Contributions are welcome. See the [Expo modules docs](https://docs.expo.dev/modules/get-started/) for information on how to build/run/develop on the project.
|
|
0 commit comments