We've been informed it's possible for an app to create a world
readable hardlink in L in its own /data directory that links to
another apps private data, including Messenger data. The hardlink
bypassed our existing checks. So now we simply refuse all file: uris
in the /data/ directory.
Other apps shouldn't be sending file uris anyway, and we dont know
of any that send file:///data/ uris.
Bug: 28793303
Change-Id: I778bb2bcb9e11185357093c59fc1fa3f6caa26a1
am: 22e3fb6074
* commit '22e3fb607435e2c24c9d4430a2c4b8d693e3cb80':
Messaging doesn't allow sharing of its own files
Change-Id: I61a467aa2debeb9a7feb10e753be8b472bca1195
am: 65e8a2d330
* commit '65e8a2d33005760f03bb0ca2c412332ab82f7413':
Messaging doesn't allow sharing of its own files
Change-Id: I5b3a6ffadacd8da1c8db1a626f78ca2bc65a2f7e
am: 0566cc6b9a
* commit '0566cc6b9a0db6a58034e3837adfbc9ba6ab762b':
Messaging doesn't allow sharing of its own files
Change-Id: Ia4e2da91fa6479011d1966dd5d604211af416745
am: ca5fc9fa7d
* commit 'ca5fc9fa7dbba6cbab625d4a80f812b7206f0676':
Messaging doesn't allow sharing of its own files
Change-Id: Ice1aa04a938f9ff14ac3b321344c34bfd152b1dc
am: ca5fc9fa7d
* commit 'ca5fc9fa7dbba6cbab625d4a80f812b7206f0676':
Messaging doesn't allow sharing of its own files
Change-Id: I812ae5e1b37611a69090e024a858c5813a4a155f
-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