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

prevent upload from sensitive path #8433

Merged
merged 1 commit into from May 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -29,6 +29,7 @@
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.OnAccountsUpdateListener;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
Expand Down Expand Up @@ -449,6 +450,7 @@ private Integer gatherAndStartNewUploads(
/**
* Start a new {@link UploadFileOperation}.
*/
@SuppressLint("SdCardPath")
private void startNewUpload(
User user,
List<String> requestedUploads,
Expand All @@ -461,6 +463,11 @@ private void startNewUpload(
OCFile file,
boolean disableRetries
) {
if (file.getStoragePath().startsWith("/data/data/")) {
Log_OC.d(TAG, "Upload from sensitive path is not allowed");
return;
}

OCUpload ocUpload = new OCUpload(file, user.toPlatformAccount());
ocUpload.setFileSize(file.getFileLength());
ocUpload.setNameCollisionPolicy(nameCollisionPolicy);
Expand Down