Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

MUL-1501 security improvements, moved all security methods to class, new core lib fix #221

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

altvnv
Copy link
Contributor

@altvnv altvnv commented Jun 1, 2018

Added Google SafetyNET API
Some corelib fixes (according to latest version)
Created SecurityHelper class

public static boolean preventRootIfDetected(AppCompatActivity activity) {
if (isRooted(activity)) {
if (SecurityHelper.notSecured(activity)) {
Copy link
Collaborator

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();
Copy link
Collaborator

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;
Copy link
Collaborator

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());
Copy link
Collaborator

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);
Copy link
Collaborator

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);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too much spaces\newlines

@altvnv altvnv changed the title security improvements, moved all security methods to class, new core lib fix MUL-1501 security improvements, moved all security methods to class, new core lib fix Jun 1, 2018
byteStream.write(bytes);
byteStream.write(data.getBytes());
} catch (IOException e) {
return null;
Copy link
Collaborator

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants