Messaging doesn't allow sharing of its own files
-Previously, Messaging allowed sharing of any file it had permission to reach. This meant that bad apps could share a link to file:///data/data/com.android.messaging/databases/bugle_db and Messaging would happily send all this sensitive information to the target. Worse, a bad app could share a softlink to this file, where the symlink was picture.jpg with the image/jpg type. -Now, when sanitizing attachments, we make sure any filepaths don't lead to any Bugle-specific directories. -getApplicationInfo().dataDir is a symlink to /data/data/com.android.messaging, and appears to be the only directory where we store personal data. -Most apps share as contentUris, including Messaging, so Messaging can still share to itself. Change-Id: Ic464bc1f099029a030793c478aaf88b957d8bad1 Fixes:28076752
This commit is contained in:
@@ -34,6 +34,7 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.MediaMetadataRetrieverWrapper;
|
||||
import com.android.messaging.util.FileUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -158,8 +159,12 @@ public class ShareIntentActivity extends BaseBugleActivity implements
|
||||
}
|
||||
|
||||
private void addSharedImagePartToDraft(final String contentType, final Uri imageUri) {
|
||||
mDraftMessage.addPart(PendingAttachmentData.createPendingAttachmentData(contentType,
|
||||
imageUri));
|
||||
if (FileUtil.isInPrivateDir(getBaseContext(), imageUri)) {
|
||||
Assert.fail("Cannot send private file " + imageUri.toString());
|
||||
} else {
|
||||
mDraftMessage.addPart(PendingAttachmentData.createPendingAttachmentData(contentType,
|
||||
imageUri));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user