Skip to content

[BOUNTY #2851] Remote DroidGuard server guide + multi-step session support - #3705

Open
Karan02204 wants to merge 2 commits into
microg:masterfrom
Karan02204:master
Open

[BOUNTY #2851] Remote DroidGuard server guide + multi-step session support#3705
Karan02204 wants to merge 2 commits into
microg:masterfrom
Karan02204:master

Conversation

@Karan02204

Copy link
Copy Markdown

Problem
Remote DroidGuard previously only supported single-step flows. Play Integrity (and related flows) use a multi-step DroidGuard process involving init/initWithRequest, multiple snapshot calls, and session state.

As a result, setting DroidGuard to Network (remote) mode did not work for Play Integrity. Users were forced to run root + bypass modules (TrickyStore, PlayIntegrityFix, etc.) on their daily driver.

This was the core technical blocker described in #2851.

Solution
This PR fully enables remote DroidGuard for Play Integrity by improving the remote client implementation.

Key Changes

  • Reworked RemoteHandleImpl.kt:

  • Full IDroidGuardHandle lifecycle: init, initWithRequest, snapshot, close

  • Session ID (sid) management for multi-step flows

  • Proper forwarding of DroidGuardResultsRequest.bundle (supports String, ByteArray, lists, etc.)

  • Added protocol support for action=init and action=close

  • Robust payload encoding + response parsing (including sid|result format)

  • Graceful fallback to stateless mode

Play Integrity flows now work over remote:

  • pia_attest_e1
  • pia_express
  • Other multi-step flows
  • All high-level callers (DroidGuard.getClient().getResults(...), IntegrityService, ExpressIntegrityService, PoTokenHelper, etc.) automatically benefit when remote mode is enabled.

Documentation
Added comprehensive documentation:

docs/remote-droidguard.md — complete guide covering:

  • Client setup (microG Settings)
  • Full remote protocol specification
  • Reference server implementation examples
  • How to run on stock phones vs custom-ROM server devices
  • Testing, security, and limitations

docs/remote-droidguard-server-example.kt — ready-to-adapt server code
Impact

  • Enables offloading Play Integrity attestation to another device (stock phone, home server, or commercial service).
  • Client devices no longer require root or constant bypass maintenance.
  • Opens the path for commercial "integrity as a service" offerings.
  • Fixes related issues (Firebase App Check, Dott, banking apps, etc.) on microG/custom ROM devices when using a passing remote backend.

Related

Notes

  • This PR delivers the client-side fix (the difficult part).
  • A full production remote DroidGuard server app is still recommended as follow-up work (protocol + examples are included).
  • The legacy guardWithRequest direct callback path still contains a TODO (not used by current Play Integrity code paths).

- Rework RemoteHandleImpl to support full handle lifecycle (init/initWithRequest + snapshot + close)
- Add session ID (sid) management for multi-step flows (pia_attest_e1, pia_express, etc.)
- Properly forward DroidGuardResultsRequest bundle data (strings, byte arrays, lists)
- Add support for init/close actions in the remote protocol
- Add comprehensive documentation + reference server examples

This addresses the core blocker described in microg#2851 so that Play Integrity can work over remote DroidGuard.

Related: microg#2851

🤖 Generated with [Arena.ai](https://arena.ai)
droidguard: Support multi-step remote DroidGuard for Play Integrity
@Karan02204 Karan02204 changed the title [BOUNTY #2851] Remote DroidGuard server guide + multi-step session support- #3682 [BOUNTY #2851] Remote DroidGuard server guide + multi-step session support Aug 9, 2026
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