1

On Android devices, is data from one app sandboxed from all the other apps?

If so, how is that enforced? Is it merely something like file permissions? Are each App's data encrypted with a unique per-app key? What is the mechanism that enables and enforces the sandbox between application data?

2

Disclaimer: My Android internals knowledge is somewhat out of date and a little hazy besides. Corrections welcomed.

First of all, yes. Absent special permissions, apps can't read or write data that is specific to any other app, and each app gets a unique sandbox where it - and no other app - has access.

As for how this is implemented, I believe it's a mix of file permissions and namespaces, plus other security measures to protect the system itself (rather than just other apps) from a malicious app. Each app bundle includes a manifest file which declares "capabilities" that the app requires, which include things like accessing various devices, services, kernel capabilities, and other parts of the file system. The OS creates a unique user - and, I believe, a unique user namespace - for each app, along with a set of locations in the file system (install directory, various data directories) that the app (and no other app) will have access to; I expect this separation is achieved both through file permissions and mount namespaces (much like chroot). Locations that might be shared between apps, such as download directories, can be declared in the app's manifest and then added to the locations the app can access (either at install time or, on modern Android versions, when the app requests it via an IPC to a more-privileged broker). Locations that are always shared between apps (such as read-only access to common system libraries) are also included in the files that each app can access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.