Skip to content
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

Account deactivation #2531

Merged
merged 66 commits into from
May 31, 2024
Merged

Account deactivation #2531

merged 66 commits into from
May 31, 2024

Conversation

dholms
Copy link
Collaborator

@dholms dholms commented May 28, 2024

Adds facilities for account deactivation to the PDS, appview & Ozone

  • PDS
    • return status on session routes
    • take account deactivation into account in auth verifier
    • as part of that^^ revamp standard auth-verifier to take some params for more bespoke auth configurations
  • appview
    • strip deactivated accounts from routes. treat similar to takedowns
    • throw on getProfile on a deactivated account
  • ozone
    • hydrate account deactivation state onto repo views

@dholms dholms marked this pull request as ready for review May 31, 2024 15:18
Comment on lines +66 to +70
actorIsNoHosted(did: string, state: HydrationState): boolean {
return (
this.actorIsDeactivated(did, state) || this.actorIsTakendown(did, state)
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw it defined elsewhere to take into account suspensions. Do we need to do that here? From packages/bsky/src/hydration/actor.ts:

      const isNoHosted =
        actor.takenDown ||
        ['takendown', 'suspended', 'deactivated'].includes(
          actor.upstreamStatus ?? '',
        )

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohp nevermind, I see it!

"status": {
"type": "string",
"description": "Hosting status of the account. If not specified, then assume 'active'.",
"knownValues": ["active", "takendown", "suspended", "deactivated"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we feel about the fact that active may appear here but is not a hosting status under com.atproto.sync?

I think I like the convention that a status indicates a reason for a no-host, so if you see a value you don't understand you can at least assume it still indicates no-host. One result of that is that the logic around this field could be const noHost = !!status && status !== 'active', which is pretty nice. Would it be even nicer if it were just const noHost = !!status? I notice in a fair amount of logic in this PR we check explicitly for the known values to determine a no-host.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ended up updating this to match the sematnics of getRepoStatus with the active boolean

@@ -18,7 +18,7 @@ export default function (server: Server, ctx: AppContext) {
calcKey: ({ auth }) => auth.credentials.did,
},
],
auth: ctx.authVerifier.accessCheckTakedown,
auth: ctx.authVerifier.accessFull({ checkTakedown: true }),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw other accessCheckTakedown become accessStandard({ checkTakedown: true }), double-checking that this one differs intentionally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i'm not really sure this matters because ultimately you need a password to delete an account. But this request should really only be coming from a fully-permissioned session. I think we didn't the full check earlier because we didn't have an authVerifier helper to make it possible

Comment on lines 8 to +11
server.com.atproto.repo.uploadBlob({
auth: ctx.authVerifier.accessCheckTakedown,
auth: ctx.authVerifier.accessStandard({
checkTakedown: true,
}),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No biggie either way, but I imagine we could do a deactivated step too since this is part of a write flow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I originally did that, but uploadBlob is used in the account migration flow (during which the account is deactivated). Since uploadBlob doesn't actually produce firehose events, I figured it was okay to let it through

May be worth revisiting if we want an account that is in the process of importing their repo to actually be "deactivated"

Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ace!

@dholms dholms merged commit 255d5ea into main May 31, 2024
10 checks passed
@dholms dholms deleted the account-deactivation branch May 31, 2024 21:39
@github-actions github-actions bot mentioned this pull request May 31, 2024
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.

3 participants