Skip to content
This repository was 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
altvnv wants to merge 4 commits intoAppscrunch:masterfrom
altvnv:master
Open

MUL-1501 security improvements, moved all security methods to class, new core lib fix#221
altvnv wants to merge 4 commits intoAppscrunch:masterfrom
altvnv:master

Conversation

@altvnv
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants