Skip to content

Android: send Firebase App Check (Play Integrity) token to the proxy - #27

Draft
eman-cickusic wants to merge 1 commit into
benevolentbandwidth:mainfrom
eman-cickusic:feat/android-app-check
Draft

Android: send Firebase App Check (Play Integrity) token to the proxy#27
eman-cickusic wants to merge 1 commit into
benevolentbandwidth:mainfrom
eman-cickusic:feat/android-app-check

Conversation

@eman-cickusic

Copy link
Copy Markdown
Contributor

Draft — blocked on Firebase/Play setup. Do not merge yet. Client half of the abuse-control workstream; pairs with the backend App Check PR (#26).

What it does

Attaches an X-Firebase-AppCheck header to /analyze and /chat so the backend can verify requests come from the genuine app once enforcement is enabled.

  • App.kt (Application) + network/llm/AppCheckTokenProvider.kt: install the Play Integrity provider and fetch tokens.
  • Dormant until google-services.json exists — no default FirebaseApp → currentToken() returns null → no header. So this does not change behavior or break the build before Firebase is configured.
  • Firebase BoM + App Check deps; Google Services plugin applied only when google-services.json is present. Manifest registers the Application.
  • Header added in both proxy workflows — no public API change, existing tests unaffected (token is null without Firebase).

⚠️ Before this can merge / work

  1. Firebase console: add Firebase to b2-ultra-processed, register app com.b2.ultraprocessed, download google-services.json into app/.
  2. Play Console: enable Play Integrity + register it as the App Check provider (needs the release SHA-256).
  3. Build on a normal network (see note below), confirm :app:testDebugUnitTest passes.
  4. Then enable backend enforcement (APP_CHECK_ENABLED=true) only after this ships and has adoption.

⚠️ Not built in CI/authoring env

I could not compile this where it was written — dl.google.com (Google's Maven) was unreachable, so the Firebase artifacts couldn't download. Code is reviewed against the Firebase App Check API but needs a real build. Firebase BoM pinned at 33.7.0 — bump if desired.

Full plan: documentation/15-backend-abuse-controls.md.

🤖 Generated with Claude Code

Client half of the abuse-control workstream (backend is in the App Check PR).
Attaches an X-Firebase-AppCheck header to /analyze and /chat so the backend can,
once enforcement is enabled, verify requests come from the genuine app.

- App.kt (Application) + network/llm/AppCheckTokenProvider.kt: install the Play
  Integrity provider and fetch tokens. Dormant until google-services.json exists
  (no default FirebaseApp -> currentToken() returns null -> no header), so this
  does not change behavior or break the build before Firebase is configured.
- Firebase BoM + appcheck deps; Google Services plugin applied only when
  google-services.json is present. Manifest registers the Application.
- Header added in both proxy workflows (no public API change; existing tests
  unaffected since the token is null without Firebase).

NOTE: unbuilt in the authoring environment (Google Maven dl.google.com is not
reachable here, so Firebase artifacts could not download). Needs a normal-network
build + google-services.json before merge. Verified by review against the
Firebase App Check API. See documentation/15-backend-abuse-controls.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant