Owner decision 2026-10-04: fix the account privacy findings.
- Sign-in. Every failure answers "That username and password do not match." after the same work: an unknown login
is hashed against a decoy, and the comparison is constant-time. "Banned" is told only to someone who gave the right
password. This covers /clientapi/user/login, /invitation/login and /oauth/login.
- Recovery.
- Every request answers the same sentence and queues a SendRecovery job, whether or not the account exists or has an
email. The lookup, the code and SMTP move to RecoveryJob, so neither the answer nor its timing says anything.
- Codes are kept only as a SHA-256 hash, for one hour. Migration _011 drops the plaintext ones, which never expired.
- A recovered password ends every session of the root. RootSessions sets CredentialsChangedAt, which JwtEvents
checks against the JWT's issue time, now stamped as nbf, and revokes each persona's OAuth tokens and authorizations.
- Deleting a root (RootRemoval: the admin route, or the restored self-delete at /clientapi/user/delete, which asks for
the password).
- Its sessions end.
- Each persona and each group it owns sends Delete{Actor} to its followers, its members and the accounts it follows.
- The personas' posts are emptied.
- /peasants/{name} answers 410 with a Tombstone (formerType Person or Group), as do its inbox and WebFinger, through
LocalActorService.Gone. The names stay reserved.
- The root keeps only a unique `deleted-{id}` name; the second deletion on an instance used to collide on
"Deleted user".
Also, from phase 2's pasture: GoToSocial files a circle post like a DM and shows it only to accounts it mentions. Each
member's copy, and a member's refetch, now also mentions that member silently. The GoToSocial scenario checks circle
posts in conversations, like DMs, and they pass there now, as on Mastodon.
657 tests pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ELjqpznMFMNrJoJUj6K5p2
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using MongoDB.Entities;
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace PrivaPub.Models.User
|
|
{
|
|
public class RootUser : Entity
|
|
{
|
|
[StringLength(32)]
|
|
public string UserName { get; set; }
|
|
[EmailAddress]
|
|
public string Email { get; set; }
|
|
public bool IsEmailValidated { get; set; } = false;
|
|
public bool IsBanned { get; set; } = false;
|
|
public string HashedPassword { get; set; }
|
|
public List<string> Policies { get; set; } = new() { ClientModels.Policies.IsUser };
|
|
public List<ContactItem> Contacts { get; set; } = new();
|
|
public RootUserSettings Settings { get; set; } = new();
|
|
|
|
public string ResetPasswordToken { get; set; }
|
|
public DateTime? ResetPasswordTokenSentAt { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
public DateTime? DeletedAt { get; set; }
|
|
public DateTime? CredentialsChangedAt { get; set; }//a /clientapi token issued before this is refused (JwtEvents)
|
|
}
|
|
|
|
public class ContactItem
|
|
{
|
|
public string Type { get; set; }
|
|
public string Contact { get; set; }
|
|
public string Note { get; set; }
|
|
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
|
}
|
|
|
|
public class RootUserSettings
|
|
{
|
|
public string LanguageCode { get; set; } = "en-GB";
|
|
|
|
public short IconsThemeIndexColour { get; set; } = 25;
|
|
public short LightThemeIndexColour { get; set; } = 25;
|
|
public short DarkThemeIndexColour { get; set; } = 215;
|
|
public bool PreferSystemTheming { get; set; } = true;
|
|
public bool ThemeIsDarkMode { get; set; } = false;
|
|
public bool ThemeIsDarkGray { get; set; } = false;
|
|
public bool ThemeIsLightGray { get; set; } = true;
|
|
}
|
|
}
|