Repository navigation
Bugfix/ftpserver harden control permission - #4758
Draft
TranceLove wants to merge 2 commits into
Draft
TranceLove wants to merge 2 commits into
TranceLove wants to merge 2 commits into
Conversation
Follow-up to the FileProvider root-path / pre-grant hardening. With root-path narrowed to storage/ and mnt/media_rw/, files elsewhere (eg. /data, root-only files) no longer get a provider URI, so opening, sharing, picking and installing them would throw. Changes: - Add FileUtils.getShareableUri(): returns the provider URI when the path is covered, otherwise copies the file into cache/open_with/<uuid>/ and returns the URI of the copy. Root-only files are read through SuFileInputStream and written by the app itself, so the copy carries the app's own SELinux label/ownership (no root cp/chmod). Copies older than 24 hours are purged. - Add getShareableUriAsync() (RxJava Maybe): copying runs on the IO scheduler, shows the "Copying" toast, result delivered on main thread. - Add ShareCopyException; copy failures show copy_error toast, files that cannot be shared at all keep showing no_app_found. - Use the async helper in openFile, openWith(File), shareFiles, installApk and MainFragment.returnIntentResults (picker). - fromContentUri() maps storage_root/ -> /storage/ and media_rw_root/ -> /mnt/media_rw/, keeping legacy URI fallback; the database viewer path extra now uses it. - Tests in FileUtilsTest for URI mapping, cache copy, name collisions, async scheduling/toast and root copy failure cleanup. Grants stay READ-only everywhere, so external editors cannot write back to the original file; this is intentional (strictest, per the report).
Make CONTROL_FTP_SERVER signature-only and add CONTROL_FTP_SERVER_SIMPLE (dangerous) guarding a new FtpExternalControlReceiver that only starts or stops the server with saved settings and never forwards intent extras.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Hardening fixes
Actionscom.amaze.filemanager.action.EXTERNAL_START_FTPandcom.amaze.filemanager.action.EXTERNAL_STOP_FTPwhich takes no arguments - just start and stop signals.Courtesy of report by Zhang Jinshan 2831737873a@gmail.com thanks!
Automatic tests
Manual tests
Done
Device:
OS:
Build tasks success
Successfully running following tasks on local:
./gradlew assembledebug./gradlew spotlessCheckGenerative code
This PR used generative code tools (GenAI, LLMs, etc.)
Model: Claude Sonnet
Version: 5.5
Provider: Github Copilot