Skip to content
New issue

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

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

Already on GitHub? # to your account

[core] Change class modifiers if used outside the package #729

Closed
bagipro opened this issue Jul 31, 2019 · 7 comments
Closed

[core] Change class modifiers if used outside the package #729

bagipro opened this issue Jul 31, 2019 · 7 comments
Labels
bug Core Issues in jadx-core module

Comments

@bagipro
Copy link
Collaborator

bagipro commented Jul 31, 2019

Checks before report

Describe error
Hi, I've noticed a lot of classes (which in their past life were lambdas/anonymous classes) placed to different package, but have package-private modifiers. Example is in file com/paypal/android/sdk/contactless/reader/tlv/TLVTransformer.java

    public static final TLVTransformer<String> TO_HEX_STRING_NO_WHITESPACE = new p000.C3854Zg();

and

package p000;

/* renamed from: Zg  reason: case insensitive filesystem */
class C3854Zg implements TLVTransformer<String> {

Can it be changed to public (as a part of --respect-bytecode-access-modifiers argument)?

APK: https://drive.google.com/file/d/1AH04tuU-rwCGpznW5IrjlunnxApQGnLo/view?usp=sharing

@bagipro bagipro added bug Core Issues in jadx-core module labels Jul 31, 2019
@bagipro
Copy link
Collaborator Author

bagipro commented May 18, 2020

@skylot
Can you fix this please? It appears that the bindings are not being resolved if a part of parent expression is not accessible in current scope (e.g. new InaccessibleClass().method(), so reference to method() won't be resolved, and this creates a lot of problems)

This could be a part of --respect-bytecode-access-modifiers option when disabled

@skylot
Copy link
Owner

skylot commented May 22, 2020

@sergey-wowwow
I made a fix in dex-input-refactor branch. In this branch, I made a new dex parser which allows instructions fast scan to collect usage info.

@bagipro
Copy link
Collaborator Author

bagipro commented May 22, 2020

Thanks! But please check class okhttp3.CertificatePinner$Builder

        @org.jetbrains.annotations.NotNull
        public final okhttp3.CertificatePinner build() {
            return new okhttp3.CertificatePinner(kotlin.collections.CollectionsKt___CollectionsKt.toSet(this.pins), null);
        }

In this case class kotlin.collections.CollectionsKt___CollectionsKt is package-private

And similar thing in class com.google.android.gms.common.api.internal.zabo

    private final /* synthetic */ com.google.android.gms.common.api.internal.GoogleApiManager.zac zajg;

in this case inner class com.google.android.gms.common.api.internal.GoogleApiManager$zac is declared as private:

    private class zac implements com.google.android.gms.common.api.internal.zach, com.google.android.gms.common.internal.BaseGmsClient.ConnectionProgressReportCallbacks {

APK: https://drive.google.com/file/d/1qC3tlWs9AtPBpyS6iU9kcSphLryfJOxi/view?usp=sharing

@skylot
Copy link
Owner

skylot commented May 26, 2020

@sergey-wowwow another fix, same branch.

@bagipro
Copy link
Collaborator Author

bagipro commented May 26, 2020

Thanks @skylot!
Please check different APK, there are a few cases where the bug still exists
Class com.grab.payments.ui.wallet.creditcard.C36875l (com.grab.payments.ui.wallet.creditcard.l)

        public void onSuccess(com.stripe.android.model.Source source) {
            if (source != null) {
                com.stripe.android.model.StripeSourceTypeModel sourceTypeModel = source.getSourceTypeModel(); // <<<

class com.stripe.android.model.StripeSourceTypeModel is package-private

and

class net.rtccloud.sdk.User

                    u.displayName = builder.displayName();
                    u.extras.putAll(builder.extras());
                    return u;

fields displayName and extras are private and inaccessible in this scope

APK: https://drive.google.com/file/d/1Umqt8wXZTm4sBqsvzjEFq-97qC-i8l-b/view?usp=sharing

@skylot
Copy link
Owner

skylot commented May 27, 2020

@sergey-wowwow I made a fix for the first case. In the second case variable u must be User type or at least cast to it to match bytecode. I will try to fix that in the next commit.

@skylot
Copy link
Owner

skylot commented May 29, 2020

@sergey-wowwow commit a fix for second case.
Also, I merged dex-input-refactor into master, so fix also in master now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Core Issues in jadx-core module
Projects
None yet
Development

No branches or pull requests

2 participants