Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Fixes - Overall vs Previous Iteration #12

Open
wants to merge 36 commits into
base: prev-security-iteration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d98a279
remove-support-for-unused-encryptionKeyValue
mascot6699 Jan 15, 2020
4688b09
Textual changes for new comers
mascot6699 Jan 15, 2020
8142c6d
Add progaurd rule to enable code obfuscation
mascot6699 Jan 15, 2020
d9b85c8
Adds basic anti-debug
mascot6699 Jan 15, 2020
87aaef5
Adds basic anti-emulator
mascot6699 Jan 15, 2020
cecc94f
Merge pull request #8 from cruxprotocol/remove-support-for-unused-enc…
mascot6699 Jan 15, 2020
50f2ca4
Merge pull request #9 from cruxprotocol/develop
mascot6699 Jan 15, 2020
9e278b3
Adds basic anti-root added
mascot6699 Jan 15, 2020
85abb7e
Finalize sad safety with randomize erros
mascot6699 Jan 16, 2020
aa9e9a1
Randomize error
mascot6699 Jan 16, 2020
1fc81f3
Merge pull request #10 from cruxprotocol/feature/insecure-environment…
mascot6699 Jan 16, 2020
aad39a9
* Passing gson instead of creating a new object everytime CruxJSBridg…
SanchayPahalwani Jan 16, 2020
0e8cc33
fixes to print error properly
mascot6699 Jan 16, 2020
30ca459
* Updated prod cruxpay-0.1.9.js and cleartext storage of sensitive in…
SanchayPahalwani Jan 16, 2020
810017a
Merge branch 'fix/security-review' of https://github.com/cruxprotocol…
mascot6699 Jan 16, 2020
d5f6901
m
mascot6699 Jan 16, 2020
6c37fc9
m
mascot6699 Jan 17, 2020
9dceefd
Merge pull request #11 from cruxprotocol/fix/security-review
mascot6699 Jan 17, 2020
6f388aa
Add crc32 for jsFile included for tamperproofing
mascot6699 Jan 17, 2020
b052d0a
updated to latest sdk
mascot6699 Jan 21, 2020
8260f2f
Debug level logs
mascot6699 Jan 22, 2020
cf94753
Hardcode privKey in char[] to test
SanchayPahalwani Feb 4, 2020
89b7fa0
char[] changes
SanchayPahalwani Feb 5, 2020
c093f74
fixes
prakhar-cs Feb 6, 2020
80221dd
fixes-2
prakhar-cs Feb 6, 2020
00d0e02
char[] back to String changes
SanchayPahalwani Feb 6, 2020
62f7b1f
Removed unused method
SanchayPahalwani Feb 6, 2020
3b3ef8a
fixes v3
prakhar-cs Feb 6, 2020
08467bc
Upgraded cruxpay to 0.2.0
SanchayPahalwani Feb 6, 2020
e10a5da
Merge t push`branch 'fix/wipe-privKey-securely' of github.com:cruxpro…
SanchayPahalwani Feb 6, 2020
7b12c9c
Merge branch 'feature/safety-checks' of github.com:cruxprotocol/andro…
SanchayPahalwani Feb 7, 2020
c0009aa
Merge pull request #14 from cruxprotocol/fix/wipe-privKey-securely
quixote911 Feb 7, 2020
3ef492e
Merge branch 'feature/safety-checks' of github.com:cruxprotocol/andro…
SanchayPahalwani Feb 10, 2020
52148bb
* Addresses PR comments
SanchayPahalwani Feb 10, 2020
dd5ca87
Merge pull request #17 from cruxprotocol/fix/log-injection
quixote911 Feb 14, 2020
2cc59db
Remove print from one more place
quixote911 Feb 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ android {
}
buildTypes {
release {
minifyEnabled false
// Enables code shrinking, obfuscation, and optimization for only
// your project's release build type.
minifyEnabled true

// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Expand Down
5 changes: 5 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# To fix errors and force R8 to keep certain code, add a -keep line in the ProGuard rules file. For example:
# -keep public class MyClass
-dontwarn com.crux.sdk.**
-keep class com.crux.sdk.** {*;}
40 changes: 27 additions & 13 deletions app/src/main/java/com/example/liquid_test_2/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

import android.content.Context;
import android.os.Bundle;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.crux.sdk.CruxClient;
import com.crux.sdk.model.CruxAddress;
import com.crux.sdk.model.CruxClientError;
import com.crux.sdk.model.CruxClientInitConfig;
import com.crux.sdk.model.CruxClientResponseHandler;
import com.crux.sdk.model.CruxIDState;
import com.crux.sdk.model.CruxPutAddressMapSuccess;
import com.crux.sdk.model.*;
//import com.crux.sdk.model.CruxAddress;
//import com.crux.sdk.model.CruxClientError;
//import com.crux.sdk.model.CruxClientInitConfig;
//import com.crux.sdk.model.CruxClientResponseHandler;
//import com.crux.sdk.model.CruxIDState;
//import com.crux.sdk.model.CruxPutAddressMapSuccess;

import java.io.IOException;
import java.util.HashMap;
Expand All @@ -38,7 +40,14 @@ public String runScript(final Context androidContextObject) throws IOException,
.setWalletClientName("cruxdev")
.setPrivateKey("cdf2d276caf0c9c34258ed6ebd0e60e0e8b3d9a7b8a9a717f2e19ed9b37f7c6f");

final CruxClient client = new CruxClient(configBuilder, androidContextObject);
CruxClient client;
try {
client = new CruxClient(configBuilder, androidContextObject);
} catch(CruxClientError e) {
Toast.makeText(androidContextObject, "Client caught and reraised:" + e.errorMessage, Toast.LENGTH_LONG).show();
System.out.println("use debug version for development");
return null;
}

final String testAvailabilityCruxId = "yadu007";
client.isCruxIDAvailable(testAvailabilityCruxId, new CruxClientResponseHandler<Boolean>() {
Expand All @@ -55,7 +64,8 @@ public void onResponse(Boolean successResponse) {

@Override
public void onErrorResponse(CruxClientError failureResponse) {
System.out.println(failureResponse);
System.err.println(failureResponse.errorCode);
System.err.println(failureResponse.errorMessage);
}
});

Expand All @@ -68,7 +78,8 @@ public void onResponse(Void successResponse) {

@Override
public void onErrorResponse(CruxClientError failureResponse) {
System.out.println(failureResponse);
System.err.println(failureResponse.errorCode);
System.err.println(failureResponse.errorMessage);
}
});

Expand All @@ -81,7 +92,8 @@ public void onResponse(CruxIDState successResponse) {

@Override
public void onErrorResponse(CruxClientError failureResponse) {
System.out.println(failureResponse);
System.err.println(failureResponse.errorCode);
System.err.println(failureResponse.errorMessage);
}
});

Expand All @@ -94,7 +106,8 @@ public void onResponse(HashMap<String, CruxAddress> successResponse) {

@Override
public void onErrorResponse(CruxClientError failureResponse) {
System.out.println(failureResponse);
System.err.println(failureResponse.errorCode);
System.err.println(failureResponse.errorMessage);
}
});

Expand Down Expand Up @@ -123,7 +136,8 @@ public void onResponse(CruxPutAddressMapSuccess successResponse) {

@Override
public void onErrorResponse(CruxClientError failureResponse) {
System.out.println(failureResponse);
System.err.println(failureResponse.errorCode);
System.err.println(failureResponse.errorMessage);
}
});

Expand All @@ -136,7 +150,7 @@ private HashMap<String, CruxAddress> getCurrencyMap() {
currencyMap.put("btc", new CruxAddress("1HX4KvtPdg9QUYwQE1kNqTAjmNaDG7w82V", null));
currencyMap.put("eth", new CruxAddress("0x0a2311594059b468c9897338b027c8782398b481", null));
currencyMap.put("tron", new CruxAddress("TG3iFaVvUs34SGpWq8RG9gnagDLTe1jdyz", null));
currencyMap.put("xrp", new CruxAddress("rpfKAA2Ezqoq5wWo3XENdLYdZ8YGziz48h", "5555"));
currencyMap.put("xrp", new CruxAddress("rpfKAA2Ezqoq5wWo3XENdLYdZ8YGziz48h", "7777"));
return currencyMap;
}

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
tools:context=".MainActivity">

<TextView
android:padding = "30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:gravity="center"
android:text="Check Logcat! Code is executing in background for a sample CruxID"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">Liquid_Test_2</string>
<string name="app_name">CRUX Android Sample</string>
</resources>
Loading