Skip to content

Conversation

ranjbarhadi
Copy link

this little code check if the target package is bazaar client. this prevents malicious tools like lucky patcher to easily impersonate as bazaar client app and unlock premium content.

this little code check if the target package is bazaar client. this prevents malicious tools like lucky patcher to easily impersonate as bazaar client app and unlock premium content.
…stalled

on devices with older android version, if bazaar client is not installed a null pointer exception will be thrown resulting a force close when user wants to buy something
@ranjbarhadi ranjbarhadi changed the title increase security of in-app billing increase security of in-app billing & fixing bugs Apr 24, 2017

Intent serviceIntent = new Intent("ir.cafebazaar.pardakht.InAppBillingService.BIND");
serviceIntent.setPackage("com.farsitel.bazaar");
if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
Copy link
Author

@ranjbarhadi ranjbarhadi Apr 24, 2017

Choose a reason for hiding this comment

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

this line will cause a null pointer exception to be thrown if bazaar client is not installed

if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
PackageManager pm=mContext.getPackageManager();
List<ResolveInfo> intentServices = pm.queryIntentServices(serviceIntent, 0);
if (intentServices != null && !intentServices.isEmpty()) {
Copy link
Author

Choose a reason for hiding this comment

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

this new approach will fix the app crashing issue

logDebug("Disposing.");
mSetupDone = false;
if (mServiceConn != null) {
if (mServiceConn != null && mService!=null) {
Copy link
Author

Choose a reason for hiding this comment

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

also, we should check if the service is not null

return;
} else {
mService = IInAppBillingService.Stub.asInterface(service);
}
Copy link
Author

Choose a reason for hiding this comment

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

this is the part that we check for the authenticity of target app.

@ranjbarhadi
Copy link
Author

@remohammadi @moallemi @hirbodk you guys may wanna take a look at this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants