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

Check & request operation missing before using RingtoneManager.getCursor() #66

Open
aper-project opened this issue Aug 16, 2020 · 0 comments

Comments

@aper-project
Copy link

Issue description

Hi, in ClockPlus v1.1.3, we found a dangerous API usage (https://github.com/philliphsu/ClockPlus/blob/master/app/src/main/java/com/philliphsu/clock2/dialogs/RingtonePickerDialog.java#L85) which requires Manifest.permission.READ_EXTERNAL_STORAGE in accordance to the Android official documentation (https://developer.android.google.cn/reference/android/media/RingtoneManager?hl=en#getCursor()).

However, it seems that it missed the “check” and “request” operation in the following call chain starting from the BaseAlertDialogFragment.onCreateDialog(android.os.Bundle) activity if permission is not granted.

CALLCHAIN:
	com.philliphsu.clock2.dialogs.BaseAlertDialogFragment.onCreateDialog(android.os.Bundle)android.app.Dialog
	 com.philliphsu.clock2.dialogs.RingtonePickerDialog.createFrom(android.support.v7.app.AlertDialog$Builder)android.support.v7.app.AlertDialog
	  android.media.RingtoneManager.getCursor()android.database.Cursor

This may lead to a SecurityException or related functions unavailable if the user denies the access permission but still calls the API in this chain, resulting in bad user experience.

@philliphsu
Could you help me review this issue? Thx

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

No branches or pull requests

1 participant