Skip to content

Binder: provide a SecurityPolicy factory method that requires apps to have the same signature as the platform #11238

@mateusazis

Description

@mateusazis

Is your feature request related to a problem?

The SecurityPolicies class provides several factory methods for creating SecurityPolicy instances that support common use cases, such as checking that two apps have matching signatures.

One (somewhat) common case it does not support yet is a security policy for interacting a system app (one that is embedded in the operating system). These are usually part of AOSP or provided by OEMs and commonly signed with the same certificate as the whole platform so that they can access privileged permissions.

Describe the solution you'd like

SecurityPolicies could provide another factory method that specifically checks that the given app has the same signature as the platform:

class SecurityPolicies {
  // ...
  public static SecurityPolicy hasSameSignatureAsPlatform(PackageManager packageManager, String packageName) {...}
}

The platform's signature can be retrieved by using PackageManager to query for the package named "android", which is present on all devices.

Describe alternatives you've considered

Users may call PackageManager directly to obtain the platform signature and then invoke SecurityPolicies.hasSignature. But given that this pattern is becoming more frequent in Google, we can make the process less error-prone and repetitive.

Additional context

See: https://b.corp.google.com/issues/341732695

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions