-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conduit state service #67
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, we relied on client ping to decide whether to send an intent to an activity or show a notification if no activity was in the foreground. This worked because activities would unbind when backgrounded. With components like the 'Conduit state service' staying bound, pings can succeed even if all activities are backgrounded. To address this, we now use a method relying on ActivityManager.getRunningAppProcesses to reliably check if the app is in the foreground.
- Move trusted packages to dedicated TrustedPackages class - Introduce StateUpdate record for JSON serialization - Add CompositeDisposable to manage all subscriptions - Remove redundant methods - Remove unnecessary super calls in lifecycle methods
…ularity - Centralize package verification logic in `PackageHelper`. - Add multi-signature support and debug mode for runtime flexibility. - Update `ConduitStateService` to use `PackageHelper` methods. Note: A similar class exists in the Psiphon Android project: https://github.com/Psiphon-Inc/psiphon-android/blob/0be68eb0db96a1b6aa8fb014a39ee933b6f46419/app/src/main/java/com/psiphon3/PackageHelper.java. Both classes independently verify packages based on signatures and are designed to verify each other.
Add schema version and simplify reporting the running state as a boolean
…clients Replace silent return with SecurityException when untrusted client attempts to register. This helps clients distinguish trust failures from other binding issues.
Add functionality to load and store runtime-trusted app signatures from server application params, replacing debug-only signature validation. Signatures are stored on disk and loaded at service startup.
Move runtime trusted signatures config initialization from ConduitService to ConduitStateService and rename methods to better reflect their purpose
- Replace clientSubscriptions map with clients map using IBinder as key - Consolidate state update broadcasting into single subscription - Add synchronization for client map access using clientsLock The previous implementation used IConduitStateCallback objects directly as map keys, but since these are AIDL-generated proxy objects, they don't implement equals() properly. This meant identical clients appeared different to the map, leading to duplicate registrations. Using IBinder.asBinder() as the key ensures proper client identity tracking since Binder objects implement equals() correctly.
Changes the client registration mechanism in ConduitService to use IBinder as the key for tracking registered clients instead of using the AIDL interfaces directly. This fixes an issue where clients were being registered multiple times due to AIDL-generated callback interfaces lacking proper equals/hashCode implementations.
- Fix using wrong key (callback vs binder) for client removal in unregisterClient - Remove unnecessary iterator usage since locks protect modifications - Add state caching to avoid RxJava subscription for new clients - Make client error handling and logging consistent across services
tmgrask
approved these changes
Nov 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.