grpc / grpc/grpc-java

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

Offen
#11,238 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
binder enhancement
Vorherrschende Sprache
Java
Sterne
12.1k
Forks
4k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
37

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Lies binder/src/main/java/io/grpc/binder/SecurityPolicies.java und beginne mit der vorhandenen hasSignature-Factory sowie dem im Issue beschriebenen PackageManager-Einstiegspunkt. Erledigt ist die Aufgabe, wenn eine Factory-Methode das Paket namens "android" auf die Plattform-Signatur prüft und das angeforderte Policy-Verhalten unterstützt; führe die relevanten SecurityPolicies-Tests aus, um dies zu verifizieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, java
Bereich
mobile, security
Issue-Typ
Feature
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.