Shipping a Flutter app with no INTERNET permission: the plugins that tried to add it back
I've just shipped an offline card vault in Flutter, where "no internet" is the whole promise: the Android app must not even request the permission. Here's what that took. 1. Plugins merge permissions into your manifest.
I've just shipped an offline card vault in Flutter, where "no internet" is the whole promise: the Android app must not even request the permission. Here's what that took.
1. Plugins merge permissions into your manifest. The Play Billing library adds INTERNET. The camera plugin adds RECORD_AUDIO and storage access. You remove them in android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" tools:node="remove" />
<uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
Billing still works without INTERNET: the library talks to the Play Store app, and the Play Store does the networking.
2. Camera permission implies camera hardware. Declaring CAMERA makes Play treat a camera as required, so declare it optional:
<uses-feature android:name="android.hardware.camera" android:required="false" />
3. What stays: ACCESS_NETWORK_STATE. Google's data transport library (from Play Billing) and media3 (from the camera) add it. It only tells an app whether the phone is online; it can't send or receive anything. Google Play lists it as "view network connections", so explain it to your users before they ask.
4. A release check, so it never comes back. Every release APK goes through a script that fails if INTERNET reappears after a plugin update:
perms=$(aapt2 dump permissions build/app/outputs/flutter-apk/app-release.apk)
if grep -q "android.permission.INTERNET" <<<"$perms"; then
echo "FAIL: release APK requests INTERNET" >&2; exit 1
fi
5. Crypto with libsodium from Dart (the sodium package): Argon2id for the master password (128 MiB, 4 passes: about 0.8 s on a mid-range phone), XChaCha20-Poly1305 for the vault, secretstream for backup files.
6. Two bugs worth knowing about:
- Bytes that come back over a platform channel are read-only. Our fingerprint unlock tried to wipe the key in place and spun forever. Copy them first, then wipe the copy.
- The vault can auto-lock during any
await. Passing an already-disposed key to libsodium crashes the app, so every use of the key after anawaitchecks first that the vault is still open.
7. iOS: there's no permission to remove, so the app simply contains no networking code, and the App Store privacy label reads "Data Not Collected". Purchases go through StoreKit 2, which Apple runs.
Happy to go deeper on any part in the comments.
The app is Treepisode Card Box, an offline card vault (closed source): https://treepisode.com/card-box?utm_source=devto.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.