Skip to content

Conversation

@xronyx
Copy link

@xronyx xronyx commented Nov 17, 2025

Fixes #613

  • Added validateOutputUri() function to validate custom output URIs
  • Only allow content:// URIs, reject file:// URIs to prevent file system attacks
  • Validate file extensions match compress format (JPEG: .jpg/.jpeg), (PNG: .png, WEBP: .webp)
  • Added 11 comprehensive unit tests for URI validation
  • Update CHANGELOG.md with security fix documentation

This fix prevents malicious apps from:

  • Using file:// URIs to overwrite sensitive files (e.g., SharedPreferences)
  • Writing arbitrary file types by extension mismatch
  • Exploiting the exported CropImageActivity as described in issue URI validation security issue #613

…ixes CanHub#613)

- Added validateOutputUri() function to validate custom output URIs
- Only allow content:// URIs, reject file:// URIs to prevent file system attacks
- Validate file extensions match compress format (JPEG→.jpg/.jpeg, PNG→.png, WEBP→.webp)
- Added 11 comprehensive unit tests for URI validation
- Update CHANGELOG.md with security fix documentation

This fix prevents malicious apps from:
- Using file:// URIs to overwrite sensitive files (e.g., SharedPreferences)
- Writing arbitrary file types by extension mismatch
- Exploiting the exported CropImageActivity as described in issue CanHub#613
@Canato Canato requested a review from vanniktech November 19, 2025 03:26
Copy link
Member

@Canato Canato left a comment

Choose a reason for hiding this comment

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

Approving, if anything someone who need another scheme or type we can adjust with more knowledge, but this changes are sensible and welcome

Will give another day in case someone else wanna raise something, otherwise we merge tomorrow

@xronyx
Copy link
Author

xronyx commented Nov 20, 2025

Thank you, @Canato !
Hi - @vanniktech , please feel free to take a look when convenient.

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.

URI validation security issue

2 participants