Design docs for Android push notifications, matching what iOS has today: DM and mention notifications with real message text, grouped per conversation, and tapping one opens it. - **[ADR 0004](docs/adr/0004-push-gateway-hides-device-platform.md):** one push gateway per app distribution serves both platforms, and the relay can't tell an Android installation from an iOS one. - **[ADR 0005](docs/adr/0005-android-push-enrollment-attestation.md):** Android enrollment requires hardware Key Attestation on a locked bootloader, verified offline. Later installation calls are signed with the attested key. - **[ADR 0006](docs/adr/0006-android-notifications-run-app-dart-code.md):** Android builds notifications with the app's own Dart code in a background engine, instead of a native port of the iOS extension. - **[PLANS/ANDROID_PUSH.md](PLANS/ANDROID_PUSH.md):** the spec, plus the tickets it splits into. - **CONTEXT.md:** defines *wake signal* and *push gateway*. The privacy model stays the same: pushes carry a fixed wake signal and nothing about any event. ### Validation A throwaway [prototype](https://github.com/block/buzz/tree/prototype/android-push-headless-dart) checked ADR 0006 against FCM's ~10 s handler budget. It started a headless Dart engine from a killed app, signed in to a local relay and updated a placeholder notification with the real text. | Device | Wake to real text (median, 12 cold runs) | Memory (PSS) | |---|---|---| | Pixel 9a | 0.51 s (worst 0.54 s) | ~45 MB | | Emulator, CPU slowed ~8x | 0.80 s (worst 1.05 s) | ~57 MB | The relay ran on the same machine, so real network latency is still unmeasured. With an unresponsive relay, the placeholder notification stayed and the native watchdog ended the handler. This PR changes documentation only, so no app run applies. ### Regressions None. This PR adds documentation only and changes no behavior. The design keeps iOS push working through the rollout, and the relay learns no more about devices than it does today. --------- Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Tom Brow <tomb@squareup.com>
2.3 KiB
Android push enrollment requires hardware key attestation of a trusted operating system
The push gateway's enrollment endpoints are public and have no other authentication, so an installation proves it is the gateway's app on real hardware before it can enroll: App Attest on iOS, Android Key Attestation on Android. The gateway verifies Key Attestation offline, as it does App Attest, against Google's attestation roots and its published revocation list (the gateway's one periodic online fetch). The app identity in the attestation (package name and signing certificate) is filled in by the operating system, not the secure hardware, so it proves only as much as that operating system can be trusted. The gateway therefore accepts an attestation only when the hardware reports a locked bootloader and either a verified boot state of Verified (the phone maker's OS), or SelfSigned with a verified boot key on a list the operator configures. The list is empty by default, so a default gateway accepts stock Android only; an operator can add, for example, GrapheneOS's published per-device boot keys. Phones without hardware-backed attestation get no push; there is no software fallback. Every later installation call is signed with the attested key, as App Attest assertions are on iOS. Enrollment keeps its existing challenge quotas and adds a rate limit per attested key.
Considered options
- Play Integrity. It would send Google a request for every enrollment, which works against Buzz's privacy goals, and it adds Google's server API and its quotas as a dependency.
- Accept any locked SelfSigned phone. Anyone can install a self-built OS with their own boot key and relock the bootloader, and that OS can claim to be our app. Attestation carries no stable device id and each enrollment makes a fresh key, so one such phone could script unlimited enrollments, bounded only by the deployment-wide challenge quota, whose exhaustion stops everyone else enrolling.
- Stock Android only. Simpler, with no list to maintain, but it excludes GrapheneOS, which Buzz's privacy goals make worth supporting.
- Accept any boot state. It would let more phones enroll, but a rooted phone could then claim to be any app, which leaves the endpoints open to the abuse attestation is meant to stop.