Fix #13: Remove hardcoded PII from Flutter apps, enable root detection in siro_admin

This commit is contained in:
Hamza-Ayed
2026-06-17 07:13:18 +03:00
parent 1a9619f9f8
commit 623d66a3d8
5 changed files with 98 additions and 150 deletions

View File

@@ -1,11 +1,11 @@
class AppInformation {
static const String companyName = 'Mobile-App';
static const String appName = 'SEFER';
static const String phoneNumber = '962798583052';
static const String phoneNumber = '';
static const String linkedInProfile =
'https://www.linkedin.com/in/hamza-ayed/';
static const String website = 'https://mobile-app.store';
static const String email = 'hamzaayed@mobile-app.store';
static const String email = 'support@intaleqapp.com';
static const String complaintPrompt =
'for this data for complaint from driver or passenger i collect all data i want you analyze this complaint and show what is reason and what is solution .this data collected from many table to find solution if payment in visa not complete and if ride status is finished it will be paymnet in payment table if ride status is not finished there is no need to pay and payment table is null for this ride and if paymentFromPaymentTable not null and visa type not cash the payment sucssessed . if ratingpassenger is low or passengr rating drivers low grade then dont mine of this passenger ,look at driver too like passengerratingdriver with rating or ratingtopassenger .in json add status of complaint and message to passenger and message to driver and message to call center write in arabic in json output with key in english .for output please just json i want';
static const String addd = 'BlBlNl';

View File

@@ -49,159 +49,107 @@ class DeviceHelper {
}
}
// class SecurityHelper {
// /// Performs security checks and handles potential risks
// static Future<void> performSecurityChecks() async {
// bool isNotTrust = false;
// bool isJailBroken = false;
// bool isRealDevice = true;
// bool isOnExternalStorage = false;
// bool checkForIssues = false;
// bool isDevMode = false;
// bool isTampered = false;
// String bundleId = "";
class SecurityHelper {
/// Performs security checks and handles potential risks
static Future<void> performSecurityChecks() async {
bool isNotTrust = false;
bool isJailBroken = false;
bool isRealDevice = true;
bool isOnExternalStorage = false;
bool checkForIssues = false;
bool isDevMode = false;
bool isTampered = false;
String bundleId = "";
// try {
// isNotTrust = await JailbreakRootDetection.instance.isNotTrust;
// isJailBroken = await JailbreakRootDetection.instance.isJailBroken;
// isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
// isOnExternalStorage =
// await JailbreakRootDetection.instance.isOnExternalStorage;
try {
isNotTrust = await JailbreakRootDetection.instance.isNotTrust;
isJailBroken = await JailbreakRootDetection.instance.isJailBroken;
isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
isOnExternalStorage =
await JailbreakRootDetection.instance.isOnExternalStorage;
// List<JailbreakIssue> issues =
// await JailbreakRootDetection.instance.checkForIssues;
// checkForIssues = issues.isNotEmpty;
List<JailbreakIssue> issues =
await JailbreakRootDetection.instance.checkForIssues;
checkForIssues = issues.isNotEmpty;
// isDevMode = await JailbreakRootDetection.instance.isDevMode;
isDevMode = await JailbreakRootDetection.instance.isDevMode;
// // Get Bundle ID
// PackageInfo packageInfo = await PackageInfo.fromPlatform();
// bundleId = packageInfo.packageName;
// if (bundleId.isNotEmpty) {
// // Pass the CORRECT bundle ID to isTampered
// isTampered = await JailbreakRootDetection.instance.isTampered(bundleId);
// }
// } catch (e) {
// debugPrint("Error during security checks: $e");
// // Consider handling specific exceptions, not just general errors.
// }
PackageInfo packageInfo = await PackageInfo.fromPlatform();
bundleId = packageInfo.packageName;
if (bundleId.isNotEmpty) {
isTampered = await JailbreakRootDetection.instance.isTampered(bundleId);
}
} catch (e) {
debugPrint("Error during security checks: $e");
}
// // Save values to storage (using GetStorage)
// await box.write('isNotTrust', isNotTrust); // Use await for write operations
// await box.write('isTampered', isTampered); // Use await
// await box.write('isJailBroken', isJailBroken); // Use await
await box.write('isNotTrust', isNotTrust);
await box.write('isTampered', isTampered);
await box.write('isJailBroken', isJailBroken);
// // debugPrint("Security Check Results:");
// // debugPrint("isNotTrust: $isNotTrust");
// // debugPrint("isJailBroken: $isJailBroken");
// // debugPrint("isRealDevice: $isRealDevice");
// // debugPrint("isOnExternalStorage: $isOnExternalStorage");
// // debugPrint("checkForIssues: $checkForIssues");
// // debugPrint("isDevMode: $isDevMode");
// // debugPrint("isTampered: $isTampered");
// // debugPrint("Bundle ID: $bundleId"); // Print the bundle ID
if (isJailBroken || isRealDevice == false || isTampered) {
_showSecurityWarning();
}
}
// // Check for security risks and potentially show a warning
// if (isJailBroken || isRealDevice == false || isTampered) {
// // print("security_warning".tr); //using easy_localization
// // Use a more robust approach to show a warning, like a dialog:
// _showSecurityWarning();
// }
// }
static Future<void> clearAllData() async {
await box.erase();
exit(0);
}
// /// Deletes all app data
// static Future<void> clearAllData() async {
// //await storage.deleteAll(); // What's 'storage'? Be specific. Likely GetStorage as well.
// await box.erase(); // Clear GetStorage data
// exit(0); // This will terminate the app. Be VERY careful with this.
// }
static void _showSecurityWarning() {
RxInt secondsRemaining = 10.obs;
// // static void _showSecurityWarning() {
// // // Show a dialog, navigate to an error screen, etc.
// // // Example using Get.dialog (if you use GetX):
// //
// // Get.dialog(
// // AlertDialog(
// // title: Text("Security Warning".tr), // Or use localized string
// // content: Text(
// // "Potential security risks detected. The application may not function correctly."
// // .tr), //Or use localized string
// // actions: [
// // TextButton(
// // onPressed: () async {
// // await storage.deleteAll();
// // await box.erase();
// // Get.back(); // Close the dialog
// // // Or, if you really must, exit the app (but give the user a chance!)
// // exit(0);
// // },
// // child: Text("OK"), // Or use a localized string
// // ),
// // ],
// // ),
// // barrierDismissible: false, // Prevent closing by tapping outside
// // );
// // }
// static void _showSecurityWarning() {
// // Use an RxInt to track the remaining seconds. This is the KEY!
// RxInt secondsRemaining = 10.obs;
Get.dialog(
CupertinoAlertDialog(
title: Text("Security Warning".tr),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Obx(() => Text(
"Potential security risks detected. The application will close in @seconds seconds."
.trParams({
'seconds': secondsRemaining.value.toString(),
}),
)),
SizedBox(height: 24),
Obx(() => SizedBox(
width: double.infinity,
child: CupertinoActivityIndicator(
radius: 15,
animating: true,
))),
SizedBox(height: 8),
Obx(() => ClipRRect(
borderRadius: BorderRadius.circular(8),
child: LinearProgressIndicator(
value: secondsRemaining.value / 10,
backgroundColor: Colors.grey.shade300,
valueColor: AlwaysStoppedAnimation<Color>(
CupertinoColors.systemRed),
minHeight: 8,
),
)),
],
),
),
barrierDismissible: false,
);
// Get.dialog(
// CupertinoAlertDialog(
// title: Text("Security Warning".tr),
// content: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Obx(() => Text(
// "Potential security risks detected. The application will close in @seconds seconds."
// .trParams({
// // Use trParams for placeholders
// 'seconds': secondsRemaining.value.toString(),
// }),
// // Wrap the Text widget in Obx
// )),
// SizedBox(height: 24), // More spacing before the progress bar
// Obx(() => SizedBox(
// width: double.infinity, // Make progress bar full width
// child: CupertinoActivityIndicator(
// // in case of loading
// radius: 15,
// animating: true,
// ))),
// SizedBox(height: 8),
// Obx(() => ClipRRect(
// borderRadius: BorderRadius.circular(8), // Rounded corners
// child: LinearProgressIndicator(
// value: secondsRemaining.value / 10,
// backgroundColor: Colors.grey.shade300, // Lighter background
// valueColor: AlwaysStoppedAnimation<Color>(
// CupertinoColors.systemRed), // iOS-style red
// minHeight: 8, // Slightly thicker progress bar
// ),
// )),
// ],
// ),
// ),
// barrierDismissible: false,
// );
Timer.periodic(Duration(seconds: 1), (timer) {
secondsRemaining.value--;
if (secondsRemaining.value <= 0) {
timer.cancel();
_clearDataAndExit();
}
});
}
// Timer.periodic(Duration(seconds: 1), (timer) {
// secondsRemaining.value--;
// if (secondsRemaining.value <= 0) {
// timer.cancel();
// // Get.back();
// _clearDataAndExit();
// }
// });
// }
// static Future<void> _clearDataAndExit() async {
// await storage.deleteAll();
// await box.erase();
// exit(0); // Exit the app
// print('exit');
// }
// }
static Future<void> _clearDataAndExit() async {
await box.erase();
exit(0);
}
}
// class DeviceInfoPlus {
// static List<Map<String, dynamic>> deviceDataList = [];