android icon indicating copy to clipboard operation
android copied to clipboard

Check CSR

Open tobiasKaminsky opened this issue 3 years ago • 6 comments

Signed-off-by: tobiasKaminsky [email protected]

  • [x] Tests written, or not not needed

tobiasKaminsky avatar Sep 05 '22 10:09 tobiasKaminsky

@AlvaroBrey it seems that with gplayDebug flavor we have:

java.lang.ClassCastException: com.google.android.gms.org.conscrypt.OpenSSLRSAPublicKey cannot be cast to org.conscrypt.OpenSSLRSAPublicKey
at com.owncloud.android.util.EncryptionTestIT.testModulus(EncryptionTestIT.java:187)

but it runs fine locally on genericDebug.

I do not see/understand why conscrypt is behaving differently on geplay/generic flavor.

tobiasKaminsky avatar Sep 06 '22 07:09 tobiasKaminsky

@AlvaroBrey it seems that with gplayDebug flavor we have:

java.lang.ClassCastException: com.google.android.gms.org.conscrypt.OpenSSLRSAPublicKey cannot be cast to org.conscrypt.OpenSSLRSAPublicKey
at com.owncloud.android.util.EncryptionTestIT.testModulus(EncryptionTestIT.java:187)

but it runs fine locally on genericDebug.

I do not see/understand why conscrypt is behaving differently on geplay/generic flavor.

At this line: http://github.com/nextcloud/android/blob/71f16d6e978141d58a6d92d5ee3616ddcae13379/app/src/main/java/com/owncloud/android/utils/EncryptionUtils.java#L690-L690 , KeyPairGenerator.getInstance returns different classes (org.conscrypt... in generic, com.android.gms.org.conscrypt... in gplay).

We install the Conscrypt provider here in MainApp. But in the gplay flavor, ProviderInstaller is called later, installing the gms provider and overriding the previous one.

ProviderInstaller installs up-to-date conscrypt security providers patched by Google Services regularly (documentation).

The solution to all this should be to use the RSAPublicKey interface instead of the implementation-specific OpenSSLRSAPublicKey. Pushed 19c60959cfe6c7bb6157808f6334cea5271685ce to do just that, let's see how that goes.

AlvaroBrey avatar Sep 06 '22 07:09 AlvaroBrey

Codacy

Lint

TypemasterPR
Warnings8585
Errors00

SpotBugs

CategoryBaseNew
Bad practice2929
Correctness4646
Dodgy code354354
Experimental11
Internationalization99
Multithreaded correctness99
Performance5858
Security2828
Total534534

Android-library is not set to master branch in build.gradle

github-actions[bot] avatar Sep 06 '22 07:09 github-actions[bot]

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/10713.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

github-actions[bot] avatar Sep 06 '22 07:09 github-actions[bot]

stable-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/5915-IT-stable-08-18

nextcloud-android-bot avatar Sep 06 '22 08:09 nextcloud-android-bot

master-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/5915-IT-master-08-20

nextcloud-android-bot avatar Sep 06 '22 08:09 nextcloud-android-bot

/rebase

AlvaroBrey avatar Dec 12 '22 14:12 AlvaroBrey

/rebase

AlvaroBrey avatar Dec 13 '22 16:12 AlvaroBrey

/rebase

tobiasKaminsky avatar Dec 15 '22 08:12 tobiasKaminsky

/rebase

tobiasKaminsky avatar Dec 15 '22 14:12 tobiasKaminsky

Exception is java.lang.ClassCastException: com.google.android.gms.org.conscrypt.OpenSSLRSAPublicKey cannot be cast to org.conscrypt.OpenSSLRSAPublicKey, we already saw this in a previous test, it needs to be the common interface instead

AlvaroBrey avatar Dec 15 '22 14:12 AlvaroBrey

Exception is java.lang.ClassCastException: com.google.android.gms.org.conscrypt.OpenSSLRSAPublicKey cannot be cast to org.conscrypt.OpenSSLRSAPublicKey, we already saw this in a previous test, it needs to be the common interface instead

Fixed in https://github.com/nextcloud/android/pull/10713/commits/59b225feccc739db3f463b6ebb824c1e3ac7c92a

AlvaroBrey avatar Dec 15 '22 14:12 AlvaroBrey

blue-Light-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/10713-Screenshot-blue-Light-08-36

github-actions[bot] avatar Jan 05 '23 08:01 github-actions[bot]

Codacy

Lint

TypemasterPR
Warnings8282
Errors00

SpotBugs

CategoryBaseNew
Bad practice2727
Correctness4444
Dodgy code335335
Internationalization99
Multithreaded correctness99
Performance5858
Security1818
Total500500

github-actions[bot] avatar Jan 05 '23 14:01 github-actions[bot]

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/10713.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

github-actions[bot] avatar Jan 05 '23 14:01 github-actions[bot]

master-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/7269-IT-master-16-40

nextcloud-android-bot avatar Jan 05 '23 16:01 nextcloud-android-bot