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

Unhandled SecurityException: Resolved path jumped beyond configured root #587

Open
EzequielAdrianM opened this issue Aug 14, 2023 · 3 comments

Comments

@EzequielAdrianM
Copy link

Seems like some users with super user privilege are causing a crash on the library. Here is the stack trace:

Fatal Exception: java.lang.SecurityException: Resolved path jumped beyond configured root
       at androidx.core.content.FileProvider$SimplePathStrategy.getFileForUri(FileProvider.java:864)
       at androidx.core.content.FileProvider.openFile(FileProvider.java:630)
       at android.content.ContentProvider.openAssetFile(ContentProvider.java:2070)
       at android.content.ContentProvider.openAssetFile(ContentProvider.java:2131)
       at android.content.ContentProvider$Transport.openAssetFile(ContentProvider.java:496)
       at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1860)
       at android.content.ContentResolver.openOutputStream(ContentResolver.java:1562)
       at com.canhub.cropper.BitmapUtils.writeBitmapToUri(BitmapUtils.kt:460)
       at com.canhub.cropper.BitmapCroppingWorkerJob$start$1$1.invokeSuspend(BitmapCroppingWorkerJob.kt:96)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:570)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Can we add some try/catch to the writeBitmapToUri (BitmapUtils.kt) in order to handle the SecurityException, safely return error and prevent the app from crashing.

@vanniktech
Copy link
Contributor

Can't you do this yourself?

@EzequielAdrianM
Copy link
Author

Created the pull request #590, but i was not able to compile the library via JitPack, it gives error:
Could not resolve com.vanniktech:gradle-code-quality-tools-plugin:0.23.0.

@GlebPlatoTeam
Copy link

Having similar crash reportsd, although devices are not rooted (based on Crashlytics data).

@EzequielAdrianM I saw that you created PR but declined it in the end. Was there any follow-up?

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

3 participants