Repository navigation
feat: keep a record of every change to a member's devices - #75
Merged
Merged
Conversation
Fellowship decides who a member is, so a compromised site could enrol a phone as any member or replace a key and receive that member's messages. That can't be prevented without moving the member list out of WordPress, so it is made visible instead. Each enrolment, key replacement, takeover, sign-out, revoke and removal now writes an entry to deviceEvents in the same write as the change: the member and device ids, what happened, who did it, the sign-in that proved it, and when. Clients can't read or change it, the site's account only reads Firestore, and erasing a member keeps the record. The sweep removes entries after a year, apart from the site's message retention. A takeover may also sign a statement bound to its sign-in with the device's private key. An unsigned one is still accepted and recorded with keyProved false until Link sends it; a bad signature is refused as a key mismatch.
This was referenced Nov 29, 2026
crazeydave
added a commit
that referenced
this pull request
Nov 29, 2026
Stage 5 piece 3. The Functions record every change to a member's devices in Firestore's deviceEvents (#75). The Devices screen now shows it: - The newest 20 changes across all members, above the device list, shown even when no phones are enrolled. - Each member's name links to their newest 50 changes: when, what, which device, by whom, the sign-in used, and for takeovers whether the old key was proved. - Flags for a change made by the site, an enrolment with a sign-in method that member hadn't used before in what's shown, and a takeover without the old key. - A Firestore failure shows the usual "could not be reached" notice, never an empty history. FirestoreClient gains memberEvents, recentEvents and getMany (one batch read for a history's phone labels). The README and readme.txt say plainly that a compromised site could hide this view, and that the member's own notice in Link is the check that doesn't depend on the site.
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.
Stage 5, piece 1 of the security review's follow-up. Fellowship decides who a member is, so a compromised site could enrol a phone as any member, or replace a phone's key, and receive that member's messages from then on. That can't be prevented without moving the member list out of WordPress, so this makes it visible: a record the site can't erase. Pieces 2 (telling the member, in Link) and 3 (Fellowship's Devices screen) come later, each in its own PR.
Everything is under
firebase/, which isn't in the plugin zip.What changes
deviceEvents: eachenrol,replaceKey,takeOverDevice,signOut,adminRevoke,adminRemoveandadminRevokeMemberwrites one entry, in the same transaction or batch as the change.memberId,deviceId,kind,actor(member,deviceorsite),signInProvider(google.com,apple.com, orcustomfor a Unity password or a device),platformandat.previous: {platform, label}, pluskeyProved.adminRevokeMemberwithremove) keeps their entries. Otherwise one admin call could hide what the site had done.resolveAudiencegives every sender. It now accepts an optionalkeySignature: RSA-PSS/SHA-256 overtakeover:<deviceId>:<sign-in uid>:<auth_time>(takeoverStatement()). The sign-in works only once, so this can't be replayed.keyProved: false, until a Link release sends it.fellowship_key_mismatch, with the sign-in left unspent, so Link enrols as new as it already does.firestore.rulesrefuses every client read and write. The site's account (fellowship-site@) only has Datastore Viewer.DEVICE_EVENT_RETENTION_DAYS = 365. The daily sweep deletes older entries whatever the site'sretentionDayssays, including 0.deviceEvents (memberId ASC, at DESC), for the history views to come.adminRevokeon an unknown device answers 404fellowship_no_such_devicerather than 500. Fellowship treats both as a failure.Tests
deviceEvents.test.ts:rules.test.ts: no device, identity or anonymous client can read, list, write or delete an entry.After merge
firestoreand the functions as the README says. Changed:enrol,replaceKey,takeOverDevice,signOut,adminRevoke,adminRemove,adminRevokeMember,sweep. Redeploy any that fail in groups of three.