Skip to content

A compromise force-revoke during a migration misses the source owners of shared copies on the second suite #864

Closed

Description

@WilcoLouwerse

Found during a Strict post-merge review of #691 (release promotion development → beta, merged 2026-09-29) — 🔴 blocker. Present on beta and on development (checked at c133377; file paths and line numbers below are at 5b729df).

Introduced by: #809 (second revoke), #805 (source resolution), #703 (cascade)
Location ("this line" below): lib/AppInfo/SuiteLifecycleEventRegistrar.php:117

Finding

🔴 Blocker — A compromise force-revoke during a migration misses the source owners of every shared copy on the second suite

Priority 10 makes SuiteCompromiseOnRevokeListener run before EncryptionSuiteRevokedListener within one dispatch. But a compromise force-revoke of a suite in an open migration dispatches two revoke events for the same user (forceRevoke() line 482, then endMigrationForCompromise() line 546), and the first event's EncryptionSuiteRevokedListener calls ShareTargetMapper::deleteByTargetUser($userId) — every ShareTarget where that user is recipient, for every suite, not only the revoked one. When the second event's cascade walks findByEncryptionSuiteId($otherSuite), resolveTarget() gets DoesNotExistException for each shared copy and quietly falls back to the copy itself. So for the copies on the second suite (during a migration, the received copies are split across both ends) the SOURCE is not stamped or flagged and the notification goes to the revoked user instead of the source owner — exactly the keepiq#802 defect the priority was added to fix. The same happens on any retry of a force-revoke (s1-f2) and on a force-revoke of a user's second suite.

Impact: in the attack the #809 path exists for (an attacker holding the session leaves a migration open), the owners who have to rotate the secrets they shared with the compromised user are only partly warned.

Suggested fix: resolve sources before anything is swept for the whole containment — e.g. have endMigrationForCompromise() collect both suites' blast radius (copy → source) before the first revokeSuite(), or scope deleteByTargetUser() to the copies sealed under the revoked suite (secret_id IN findByEncryptionSuiteId($suiteId)).

Done when:

  • an integration-style test (real listeners, mocked mappers that honour deletes) force-revokes suite A with markCompromised=true during a migration A→B where a shared copy sits on B, and asserts the copy's source owner is notified and the source is stamped
  • the same test is red on the head

Verification status

Verified by reading code at 5b729df; not executed.

Related: #817.

Review thread

#691 (comment)

Activity

  1. added
    bugSomething isn't working
    user-sharingUser-to-user secret sharing
    securityA user can read or write what they must not
    on Oct 1, 2026
  2. github-actions commented on Oct 1, 2026

    @github-actions
    Contributor

    Thank you for opening this issue! It has been assigned to @rubenvdlinde for review.

    What happens next:

    1. A maintainer will review this issue and determine the appropriate action
    2. If accepted, it may be converted into an OpenSpec change for structured development
    3. You will be notified of any status changes

    Triage labels:

    • triage:accept-feature — accepted as a new feature
    • triage:accept-bugfix — accepted as a bug fix
    • triage:needs-info — more information needed
    • triage:wontfix — will not be addressed
    • triage:duplicate — duplicate of another issue
  3. rubenvdlinde commented on Oct 2, 2026

    @rubenvdlinde
    Contributor

    Fixed by #890, merged into development (d77dc31). The PR body describes the change and the test that fails without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingencryption-suitesEncryptionSuite lifecyclesecurityA user can read or write what they must nottriageAwaiting triageuser-sharingUser-to-user secret sharing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions