-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
I've identified a significant security concern with the recommended approach for providing encryption keys in the package documentation.
Current Implementation:
The example suggests using --dart-define for providing encryption keys:
static Env create() {
String encryptionKey = const String.fromEnvironment("APP_ENCRYPTION_KEY");
String iv = const String.fromEnvironment("APP_IV_KEY");
return Env(encryptionKey, iv);
}Security Issues:
-
Build-time Storage:
--dart-definevalues are stored in the compiledlibapp.sofile- These values are base64 encoded but easily retrievable
- APK/IPA can be decompiled to access these values
-
Runtime Memory:
String.fromEnvironment()values are stored in plain text in memory- Memory dumps can reveal these values
- Rooted/jailbroken devices can easily access these values
-
Security Paradox:
- The package aims to secure environment variables
- But the encryption keys themselves are stored insecurely
- This creates a false sense of security
Impact:
- Anyone with access to the APK/IPA can extract the encryption keys
- The encryption becomes meaningless as the keys are easily accessible
- The security layer provided by the package is effectively bypassed
Recommendation:
The documentation should be updated to:
- Warn about the security implications of using
--dart-define - Provide alternative secure approaches for key management
- Consider implementing a more secure key provisioning mechanism
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request