grpc / grpc/grpc-java

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

Open
#11,238 0 comments 0 reactions 0 assignees View on GitHub
binder enhancement
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

### Is your feature request related to a problem?
The [SecurityPolicies](https://github.com/grpc/grpc-java/blob/master/binder/src/main/java/io/grpc/binder/SecurityPolicies.java) 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:

```java
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.