nextcloud / nextcloud/android

Decouple `DocumentsStorageProvider` from `FileContentProvider`

Open
#9,580 0 comments 0 reactions 0 assignees View on GitHub
enhancement feature: document provider hotspot: device storage security technical debt
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

`DocumentsStorageProvider` (`DSP` from here on) is our SAF provider that allows the user to pick files managed by Nextcloud from other applications, through the system picker.

Right now, `DSP` uses `FileDataStorageManager` to query the database and generate the `Document`s and their Uris to expose, which ultimately means it's coupled to `FileContentProvider`. This is a problem because it requires that `FileContentProvider` is exported and some of its paths unsecured, thus letting other apps access file information without going through the system picker. Attempts to secure these paths result in `DSP` becoming non-functional.

To solve this, we should decouple `DSP` from `FileContentProvider`, allowing us to retail `DSP` functionality while making changes to `FileContentProvider`.

**Solution steps:**
1. Implement a Repository that provides read access to our database without going through a `ContentProvider`.
2. Make `DocumentsStorageProvider` use this new Repository to list files and directories. This will require a lot of testing and may be developed at the same time as step 1.
3. Verify that write operations for `DocumentsStorageProvider` work without an exposed `FileContentProvider`, and if not, repeat steps 1 and 2 for write operations.

Input is appreciated!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.