-
Notifications
You must be signed in to change notification settings - Fork 5
MUL-1501 security improvements, moved all security methods to class, new core lib fix #221
base: master
Are you sure you want to change the base?
Conversation
public static boolean preventRootIfDetected(AppCompatActivity activity) { | ||
if (isRooted(activity)) { | ||
if (SecurityHelper.notSecured(activity)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be isSecured or !isSecured.
|
||
public class SecurityHelper { | ||
|
||
private static Random mRandom = new SecureRandom(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mStyle is for official google reps contributors. We use our default code style described at convention (see wiki).
|
||
private static Random mRandom = new SecureRandom(); | ||
private static String mResult; | ||
private static boolean Pass; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only classses should start from uppercase letter
JSONObject jsonObj = new JSONObject(decodedPayload); | ||
Pass = jsonObj.getString("basicIntegrity").equals("true"); | ||
} catch (final JSONException e) { | ||
Log.e("Error", "Json parsing: " + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always do e.printStackTrace while catching exceptions
|
||
if (e instanceof ApiException) { | ||
ApiException apiException = (ApiException) e; | ||
Log.d("Error", CommonStatusCodes.getStatusCodeString(apiException.getStatusCode()) + ": " + apiException); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also use Timber.log for logs
|
||
public static boolean notSecured(AppCompatActivity activity){ | ||
RootBeer rootBeer = new RootBeer(activity); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much spaces\newlines
byteStream.write(bytes); | ||
byteStream.write(data.getBytes()); | ||
} catch (IOException e) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is your e.printStackTraces again
Added Google SafetyNET API
Some corelib fixes (according to latest version)
Created SecurityHelper class