Binder: provide a SecurityPolicy factory method that requires apps to have the same signature as the platform
- Lingua principale
- Java
- Stelle
- 12.1k
- Fork
- 4k
- Merge medio
- 2g 17h
- PR unite (30g)
- 37
Descrizione
### 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Leggi binder/src/main/java/io/grpc/binder/SecurityPolicies.java, iniziando dalla factory hasSignature esistente e dall’entry point di PackageManager descritto nell’issue. Il lavoro è completato quando un metodo factory verifica la firma della piattaforma per il package denominato "android" e supporta il comportamento di policy richiesto; esegui i test SecurityPolicies pertinenti per verificarlo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, java
- Ambito
- mobile, security
- Tipo di issue
- Funzionalità
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 52/100