Giter Club home page Giter Club logo

safe_device's Introduction

Hi there πŸ‘‹

Hi there, I am a Stuff Mobile Application Engineer with 7 years of experience in developing high-quality, cross-platform mobile applications using Flutter SDK and Dart programming language.

I have a passion for mobile application development and love creating innovative solutions that meet the needs of clients and end-users. I have a strong proficiency in Dart programming language and a proven track record of developing high-quality mobile applications using Flutter SDK.

My expertise includes developing custom UI components, integrating REST APIs, Firebase, and SQLite databases, and optimizing application performance. I have a good understanding of Git version control and follow best practices to ensure clean, maintainable, and well-documented code.

🌐 Socials:

LinkedIn Medium Stack Overflow YouTube

πŸ’» Tech Stack:

C# Kotlin Flutter Dart Figma Adobe XD Swift Xamarin Firebase Google Cloud Flutter JWT MUI IOS ANDROID Adobe After Effects Swagger Postman Jira

πŸ“Š GitHub Stats:




Flutter Xam Shoe Pro eCommerce + Apple Watch

Flutter Xam Shoe Commerce App - Flutter

Flutter Login Ui Kit in Flutter 2.0 (Desktop,Web, iOS, Android)

Flutter Login Ui Kit in Flutter 2.0 (Desktop,Web, iOS, Android)

Govo Travel Application - Flutter (Android & iOS)

DellyShop eCommerce Application - Flutter (Android & iOS)

Xamarin XamUI Login Pages UI Kit 2 | Xamarin Forms

DellyShop eCommerce Application - Xamarin Forms (Android & iOS)

Govo Travel Application

Profile UI Kit

XamUI Xamarin Forms Login Page UI Kit ( Android & iOS )

XFShop eCommerce Application Template - Xamarin Forms (Android/iOS)

safe_device's People

Contributors

ufukhawk avatar vargascarlitos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

safe_device's Issues

The plugin `safe_device` uses a deprecated version of the Android embedding.

Since Flutter 2.5.0 it should be upgraded with Android V2 embedding.

Here the error :

The plugin safe_device uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding:

a method to show program is running on windows 11 wsa

hi, currently your project doesn't consider windows 11 WSA as an emulator.
I think it must be considered as an emulator and if this is not the case, at least it must have some method to show if this program is running on it or not.

this is essential for projects with some security restrictions. when you install the application on WSA almost every access restriction such as the private folder for application contents, disabling screen capture, etc, become useless

W/MIUIScout App(13273): Event:APP_SCOUT_WARNING Thread:main backtrace on REDMI 9 PRO

image

Details
W/MIUIScout App(13273):     at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:730)
W/MIUIScout App(13273):     at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:722)
W/MIUIScout App(13273):     at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage(com.google.android.gms:play-services-base@@18.1.0:6)
W/MIUIScout App(13273):     at android.os.Handler.dispatchMessage(Handler.java:106)
W/MIUIScout App(13273):     at android.os.Looper.loopOnce(Looper.java:210)
W/MIUIScout App(13273):     at android.os.Looper.loop(Looper.java:299)
W/MIUIScout App(13273):     at android.app.ActivityThread.main(ActivityThread.java:8319)
W/MIUIScout App(13273):     at java.lang.reflect.Method.invoke(Native Method)
W/MIUIScout App(13273):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
W/MIUIScout App(13273):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)
I/libc    (13273): Requested dump for tid 13273 (.laraseksy_bloc)
W/MIUIScout App(13273): Enter APP_SCOUT_HANG state
W/MIUIScout App(13273):  (Current message: duration=5276ms seq=57 h=com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler w=1)
W/MIUIScout App(13273): Event:APP_SCOUT_HANG Thread:main backtrace:
W/MIUIScout App(13273):     at jdk.internal.misc.Unsafe.park(Native Method)
W/MIUIScout App(13273):     at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234)
W/MIUIScout App(13273):     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1079)
W/MIUIScout App(13273):     at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1369)
W/MIUIScout App(13273):     at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278)
W/MIUIScout App(13273):     at com.google.android.gms.internal.location.zzau.getLastLocation(com.google.android.gms:play-services-location@@21.0.1:12)
W/MIUIScout App(13273):     at com.wongpiwat.trust_location.LocationAssistant.checkInitialLocation(LocationAssistant.java:494)
W/MIUIScout App(13273):     at com.wongpiwat.trust_location.LocationAssistant.access$600(LocationAssistant.java:57)
W/MIUIScout App(13273):     at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:730)
W/MIUIScout App(13273):     at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:722)
W/MIUIScout App(13273):     at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage(com.google.android.gms:play-services-base@@18.1.0:6)
W/MIUIScout App(13273):     at android.os.Handler.dispatchMessage(Handler.java:106)
W/MIUIScout App(13273):     at android.os.Looper.loopOnce(Looper.java:210)
W/MIUIScout App(13273):     at android.os.Looper.loop(Looper.java:299)
W/MIUIScout App(13273):     at android.app.ActivityThread.main(ActivityThread.java:8319)
W/MIUIScout App(13273):     at java.lang.reflect.Method.invoke(Native Method)
W/MIUIScout App(13273):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
W/MIUIScout App(13273):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)

On the first check, canMockLocation always returns true.

Android.
Permissions given:

I am calling
bool canMockLocation = await SafeDevice.canMockLocation;
result true;

again calling
bool canMockLocation = await SafeDevice.canMockLocation;
result false

Real device, not root, not FakeGPS.

SafeDevice.isJailBroken function not properly detecting the root device if Magisk app uninstaled.

Scenario steps

  1. Go to rooted devices.
  2. install the app you need, with a check of SafeDevice.isJailBroken using this plugin.
  3. initially it will detect perfectly and when installed the "Magisk App" also the code can find, it was rooted.
  4. But when uninstalled the (Magisk app ) in the same phone , the code cant find the , that this device is rooted.
  5. ie - SafeDevice.isJailBroken , it return false in the rooted device

Pls call me (+91 7373428134 ) /Whatsapp - (+91 7373428134 ) , if any further clarification required.

Gradle error

roovy.lang.MissingPropertyException: Could not get unknown property 'android' for project ':trust_location' of type org.gradle.api.Project

ps: I fixed my app by removing this package =)

Keeps crashing on me: Methods marked with @UiThread must be executed on the main thread

I don't see what might be wrong on my side ...

It's just:
bool canMockLocation = await SafeDevice.canMockLocation;

E/AndroidRuntime( 7592): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Timer-0
E/AndroidRuntime( 7592): 	at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:1230)
E/AndroidRuntime( 7592): 	at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageResponseCallback(FlutterJNI.java:905)
E/AndroidRuntime( 7592): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:160)
E/AndroidRuntime( 7592): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:238)
E/AndroidRuntime( 7592): 	at com.xamdesign.safe_device.SafeDevicePlugin$1.gotLocation(SafeDevicePlugin.java:41)
E/AndroidRuntime( 7592): 	at com.xamdesign.safe_device.MockLocation.MockLocationCheck$GetLastLocation.run(MockLocationCheck.java:90)
E/AndroidRuntime( 7592): 	at java.util.TimerThread.mainLoop(Timer.java:562)
E/AndroidRuntime( 7592): 	at java.util.TimerThread.run(Timer.java:512)

And the whole app crashes.

Flutter 2.2.0 β€’ channel stable β€’ https://github.com/flutter/flutter.git
Framework β€’ revision b22742018b (10 days ago) β€’ 2021-05-14 19:12:57 -0700
Engine β€’ revision a9d88a4d18
Tools β€’ Dart 2.13.0

Other checks (isJailBroken, isRealDevice, isOnExternalStorage, ...) seem to be working just fine.

The package considers all ios devices as jail broken

The package considers all ios devices as having an issue even if the device is real and not jailbroken.
Edit:
Something is wrong with the option isSafeDevice only ...even if other checks says that the phone is safe and cool, the isSafeDevice is always false,and this is only on ios

isSafeDevice logic is confusing

hi, i just find out that the logic for isSafeDevice is absolutely confusing

return isJailBroken || !isRealDevice || canMockLocation;

the docs indicates that :
// Check if device violates any of the above

but the variable name is isSafeDevice

I suggest to swap either the variable name or the return logic @ufukhawk

Wrong validation for rooted devices

Hi, I'm using an Android phone with Lineage OS which is not rooted neither using something like Magisk, using a custom room not necessary imposes that the user have rooted device nor impose security treats.

Basically, this lib is preventing users to access some application on a faulty validation.

Suggestion narrow down the rootBeer class validation to properly check if the device is rooted.

safe_device uses Trust-location library and it is causing ANR when used in the same project with the background_locator_2 library

Hi, your library is causing ANR in my project and it is possible that it causes the same problem in other libraries that use device location.

I/locator_exampl(19665): Thread[3,tid=19672,WaitingInMainSignalCatcherLoop,Thread*=0x7de5016400,peer=0x17ec0020,"Signal Catcher"]: reacting to signal 3
I/locator_exampl(19665): 
I/locator_exampl(19665): Wrote stack traces to '[tombstoned]'

So that you can test it, download my FORK from the background_locator_2 project and add your library in the pubspec.yaml file of the "example" project:

background_locator_2:
path: ../

path_provider: ^2.0.8
location_permissions: ^3.0.0+1

safe_device: ^1.1.2 # OR trust_location: ^2.0.13

In the example project, when you press the "Start" button, you will notice that the app freezes.

PS:

I noticed this problem when testing your library. Upon investigation, I noticed that the problem is related to the trust_location library (which your library uses).

To avoid this ANR, I FORK your project, removing the trust_location and commenting out all its usage, since I don't have the need to check the use of mock locations in my project.

I reported the issue as an issue on the trust_location project as well.

Pixel 6 simulator is detected as a rooted device

I don't have any other issues with other Pixel simulators (3a or 4 for example), only this one in particular has this issue.

Tested on two macbooks, package version 1.1.4, Flutter version 3.10.6.
If you need more information, let me know.

Later edit: reproduces on Pixel 5, both devices using API level 33.

ViperOS is considered a root?

I used google translate, sorry for my writing.

I wanted to know if ViperOS is considered a root.

In case "await SafeDevice.isJailBroken;" it is returning false

image

on ios not working

always return issue No implementation found for method isMockLocation on channel trust_location

SafeDevice.isSafeDevice throws an exception

SafeDevice.isSafeDevice throws following exception. Same behavior on both Android Emulator and Pixel 2 real device.

I/flutter ( 8131): SafeDevice:: MissingPluginException(No implementation found for method canMockLocation on channel safe_device), #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
I/flutter ( 8131):
I/flutter ( 8131): #1 SafeDevice.isSafeDevice (package:safe_device/safe_device.dart:38:34)

I'm using safe_device: ^1.0.8

Any recommendations?

ANR triggered by main thread waiting for too long

I've got 49 ANRs on 21 users caused by trust_location package (logged on Firebase Crashlytics), which is a safe_device direct dependency.

It's worth noting that I'm not even using APIs that might call trust_location, since I don't call canMockLocation and isSafeDevice, I'm only using isJailBroken and isRealDevice.

This is the stacktrace:

main (timed waiting):tid=1 systid=8469 
       at sun.misc.Unsafe.park(Native method)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1090)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1390)
       at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278)
       at com.google.android.gms.internal.location.zzau.getLastLocation()
       at com.wongpiwat.trust_location.LocationAssistant.checkInitialLocation(LocationAssistant.java)
       at com.wongpiwat.trust_location.LocationAssistant.access$600(LocationAssistant.java)
       at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java)
       at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java)
       at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage()
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:263)
       at android.app.ActivityThread.main(ActivityThread.java:8292)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)

I know that's not your direct responsibility, but having several ANRs is concerning.

Is there something that can be done?

Null check operator used on a null value

Hi,

I am trying to use your implementation, using the following code

bool isJailBroken = false;
  bool canMockLocation = false;
  bool isRealDevice = true;
  bool isOnExternalStorage = false;
  bool isSafeDevice = false;

  try {
    isJailBroken = await SafeDevice.isJailBroken;
    canMockLocation = await SafeDevice.canMockLocation;
    isRealDevice = await SafeDevice.isRealDevice;
    isOnExternalStorage = await SafeDevice.isOnExternalStorage;
    isSafeDevice = await SafeDevice.isSafeDevice;
    final bool securityBreach = (isJailBroken || canMockLocation || !isRealDevice || isOnExternalStorage || !isSafeDevice);
    log('Security:  isJailBroken: $isJailBroken  isRealDevice: $isRealDevice isOnExternalStorage: $isOnExternalStorage canMockLocation: $canMockLocation isSafeDevice: $isSafeDevice');

    if (securityBreach && !isSimulator) {
      return;
    }
  } catch (e) {
    log('[security validation] :: $e');
  }

but systematically obtain the following exception:

Null check operator used on a null value

Would you have any solution?

Many thanks

Potential Android API 19 Support

Currently, Safe Device only supports Android devices that have API 21 and above installed. Is it possible to support API 19 and above? We're trying to support a minimum of 19 in our app. Thank you for your help.

canMockLocation always true

my device Redmi note 8 pro.
i try to running default no edited code or modified but always get true for canMockLocation. is it correct or there something to configure ?

my device mock location is off and my developer mode is off

RootBeer is logging everything (Even in release mode)

Hi,
I am using your library and I noticed that you are using RootBeer to look for root.

But RootBeer is logging everything (even in release mode). Something like this is shown in logcat:

2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /data/local/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /data/local/xbin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /sbin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /su/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /system/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /system/bin/.ext/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /system/bin/failsafe/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /system/sd/xbin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /system/usr/we-need-root/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /system/xbin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /cache/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /data/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /dev/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /product/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /apex/com.android.runtime/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /apex/com.android.art/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /system_ext/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /odm/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /vendor/bin/su Absent :(
2023-08-02 20:30:48.378 11644-11644 RootBeer I LOOKING FOR BINARY: /vendor/xbin/su Absent :(

I checked RootBeer and I see it can be set.

RootBeer - Log levels

Could you add this customization in your library?

canMockLocation and isRealDevice return wrong result

First, similar with this issue
On the first check, canMockLocation always returns true. #13
#13

and
On the first check, canMockLocation always returns true.
#8

in Android, sometimes canMockLocation give true result even if the user didn't using any mock location applications.

Second, related with isRealDevice
when we tested the application using LD Player, it's always return false and recognized the user as RealDevice.

I'm using latest libs available in Pub.dev
safe_device: ^1.1.2

Thanks for your hardwork in this lib.
really appreciate.

Rgds,

MissingPluginException(No implementation found for method canMockLocation on channel safe_device)

As the title says, can't find canMockLocation channel.

Running on real developer enabled Pixel 4a device. Running Android 11.

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-arm, locale en-US)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[βœ“] Xcode - develop for iOS and macOS
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 4.1)
[βœ“] VS Code (version 1.60.0)
[βœ“] Connected device (3 available)

Exception from Flutter:
I/flutter (22322): MissingPluginException(No implementation found for method canMockLocation on channel safe_device)

Tried deleting app, reinstalling, and restarting vscode. None of restarts or reinstalls worked.

Code I'm using:

static Future isDeviceCompromised() async {
bool isCompromised = false;
try {
isCompromised = await SafeDevice.isSafeDevice;
} catch (error) {
print(error);
rethrow;
}
print('isCompromised(): $isCompromised');

return isCompromised;

}

Please let me know if you need more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.