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

SecurityException in ImportKeysActivity #2014

Open
dschuermann opened this issue Jan 26, 2017 · 3 comments
Open

SecurityException in ImportKeysActivity #2014

dschuermann opened this issue Jan 26, 2017 · 3 comments

Comments

@dschuermann
Copy link
Member

4.2.1

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=94211, result=-1, data=Intent { dat=content://media/external/file/3662 }} to activity {org.sufficientlysecure.keychain/org.sufficientlysecure.keychain.ui.ImportKeysActivity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/3662 from pid=11165, uid=10155 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
	at android.app.ActivityThread.deliverResults(ActivityThread.java:4094)
	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4137)
	at android.app.ActivityThread.-wrap20(ActivityThread.java)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1529)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6123)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/3662 from pid=11165, uid=10155 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
	at android.os.Parcel.readException(Parcel.java:1683)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
	at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
	at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:692)
	at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1145)
	at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:982)
	at android.content.ContentResolver.openInputStream(ContentResolver.java:702)
	at org.sufficientlysecure.keychain.util.FileHelper.isEncryptedFile(FileHelper.java:233)
	at org.sufficientlysecure.keychain.ui.ImportKeysFileFragment.startImportingKeys(ImportKeysFileFragment.java:146)
	at org.sufficientlysecure.keychain.ui.ImportKeysFileFragment.onActivityResult(ImportKeysFileFragment.java:133)
	at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:167)
	at org.sufficientlysecure.keychain.ui.ImportKeysActivity.onActivityResult(ImportKeysActivity.java:320)
	at android.app.Activity.dispatchActivityResult(Activity.java:6931)
	at android.app.ActivityThread.deliverResults(ActivityThread.java:4090)
	... 9 more
@dschuermann dschuermann self-assigned this Jan 26, 2017
@dschuermann dschuermann removed their assignment Jan 30, 2017
@rhari991
Copy link

rhari991 commented Feb 1, 2017

I'm not sure how this exception is occurring, permissions seem to be handled correctly. Maybe just place an additional permission check inside the startImportingKeys() method ?

@dschuermann
Copy link
Member Author

I am also not fully sure. Is the check isEncryptedFile() done after obtaining the permission?

@rhari991
Copy link

rhari991 commented Feb 1, 2017

isEncryptedFile() is only called inside startImportingKeys(), which is always called after ensuring that the permission was granted.

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

No branches or pull requests

2 participants