Repository navigation
Unsubscribe pushes for a group another device removed - #2275
Draft
mpretty-cyro wants to merge 1 commit into
Draft
mpretty-cyro wants to merge 1 commit into
mpretty-cyro wants to merge 1 commit into
Conversation
A group's push unregistration was signed with auth built from its user-groups entry. When another device removed the group, that entry was gone before the worker ran, so the request failed, was never retried, and its row was deleted anyway: the push server kept sending that group's pushes until the subscription expired. Keep each group's credentials on its push registration row (new group_auth column), fall back to them when the config no longer has the group, and log an unregistration that still can't be signed.
This file contains hidden or 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
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.
When another device removes a group (leaves it, or deletes it), this device learns about it from the user-groups config. By the time
PushRegistrationWorkerran the group's unregistration, the group's user-groups entry was already gone, and that entry was the only place its auth (admin key or sub-account auth data) lived.getGroupAuthreturned null, the request was never sent, and the row was deleted anyway. The push server kept sending that group's pushes until the subscription's signature expired (14 days). Leaving from this device wasn't affected:GroupLeavingWorkerunsubscribes before it removes the group.Change
push_registration_stategets a nullablegroup_authcolumn (DB lokiV63).PushRegistrationHandleralready reads each group's info when it builds the desired registrations; it now passes the group's credentials along, andensureRegistrationswrites them to every row for that group. Writing them doesn't count as a change, so scheduling is unchanged.PENDING_UNREGISTERonly rewritesstate, so the credentials outlive the group's removal from the config.ConfigFactoryProtocol.createGroupAuth). If neither can sign it, it logs why (no IDs or key material) and drops the row, because nothing will ever be able to sign it.PushRegistrationWorker's namespace lists are now lazy, so a JVM test can load the class.Limits
Pushes for a group this device no longer has
PushReceiveralready drops them without notifying (it only logs).Testing
PushUnregistrationTest: unsubscribing a removed group with the member auth or the admin key stored on its row, unsubscribing a group still in the config with its own auth, logging and removing an unregistration nothing can sign (alongside a positive control), checking that the skip log has no key material or IDs, and checking that the handler attaches each group's credentials.:app:testPlayDebugUnitTest: 467 passed, 0 failed.PENDING_UNREGISTER.devbuild's database and a fresh install open without errors.