Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ just auth account alice apps remove <client-id> --reason "Impersonating app"
owner: passkeys, social identities, email addresses, sessions, connected apps
and the security history, with the owner's own operations. It never adds a way
to sign in or an address. Every change needs `--reason`, which the owner sees in
their history; reads are recorded as views. See
their history; reads are recorded as views, which only the audit shows, not the
owner. See
[surfaces.md](docs/architecture/surfaces.md#changing-an-account-on-its-owners-behalf)
for what is shared.
- `user recover` is for an owner who lost every passkey. It signs the account
Expand Down
3 changes: 1 addition & 2 deletions apps/auth-service/src/history/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl Activity {
/// feed agree, as far as a count by kind can: a refresh grant's revocation
/// is left out, since the history shows only a replay's, and a session's
/// expiry is counted, since the history hides only that reason.
const SECURITY: [&'static str; 29] = [
const SECURITY: [&'static str; 28] = [
"account_created",
"signed_in",
"session_revoked",
Expand All @@ -214,7 +214,6 @@ impl Activity {
"code_replayed",
"account_disabled",
"account_enabled",
"account_viewed",
"administrator_granted",
"administrator_revoked",
"handle_changed",
Expand Down
8 changes: 6 additions & 2 deletions apps/auth-service/src/history/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ async fn pages_hold_only_the_callers_entries() {
user_id: bob.user_id,
session_id: bob.session_id,
},
vec![DomainEvent::AccountViewed {}],
// The view is hidden; the change shows.
vec![
DomainEvent::AccountViewed {},
DomainEvent::AccountEnabled {},
],
)
.await;
harness
Expand All @@ -166,7 +170,7 @@ async fn pages_hold_only_the_callers_entries() {
);
assert_eq!(
(&entries[1]["kind"], &entries[1]["actor"]),
(&json!("account.viewed"), &json!("admin"))
(&json!("account.enabled"), &json!("admin"))
);
assert_eq!(entries[2]["kind"], "passkey.renamed");
assert_eq!(entries[2]["actor"], "account");
Expand Down
10 changes: 4 additions & 6 deletions crates/common/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ pub enum DomainEvent {
/// A disabled account was reactivated.
AccountEnabled {},
/// An administrator viewed the account's details, which hold personal data.
/// Kept for the audit only: the owner's history shows changes, not reads.
AccountViewed {},
/// The account became an administrator.
AdministratorGranted {},
Expand Down Expand Up @@ -642,7 +643,6 @@ impl DomainEvent {
// The reason is written for administrators and may name other people.
Self::AccountDisabled { .. } => HistoryEntry::AccountDisabled,
Self::AccountEnabled {} => HistoryEntry::AccountEnabled,
Self::AccountViewed {} => HistoryEntry::AccountViewed,
Self::AdministratorGranted {} => HistoryEntry::AdministratorGranted,
Self::AdministratorRevoked {} => HistoryEntry::AdministratorRevoked,
Self::HandleChanged { .. } => HistoryEntry::HandleChanged,
Expand Down Expand Up @@ -686,6 +686,9 @@ impl DomainEvent {
| Self::DeliveryCancelled { .. }
| Self::SigningKeyChanged { .. }
| Self::AuditHistoryPruned { .. }
// A read may be a misclick or a confidential inquiry; the owner sees
// changes, each with its reason, not what an administrator looked at.
| Self::AccountViewed {}
// Nobody can read the history of an account that no longer exists.
| Self::AccountPurged {} => return None,
})
Expand Down Expand Up @@ -800,9 +803,6 @@ pub enum HistoryEntry {
/// The account was reactivated.
#[serde(rename = "account.enabled")]
AccountEnabled,
/// An administrator viewed the account's details.
#[serde(rename = "account.viewed")]
AccountViewed,
/// The account became an administrator.
#[serde(rename = "administrator.granted")]
AdministratorGranted,
Expand Down Expand Up @@ -885,7 +885,6 @@ impl HistoryEntry {
| Self::TokenReused
| Self::AccountDisabled
| Self::AccountEnabled
| Self::AccountViewed
| Self::AdministratorGranted
| Self::AdministratorRevoked
| Self::HandleChanged
Expand Down Expand Up @@ -928,7 +927,6 @@ impl HistoryEntry {
| Self::TokenReused
| Self::AccountDisabled
| Self::AccountEnabled
| Self::AccountViewed
| Self::AdministratorGranted
| Self::AdministratorRevoked
| Self::HandleChanged
Expand Down
1 change: 0 additions & 1 deletion crates/ui/src/settings/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ impl HistoryRow<'_> {
}
HistoryEntry::AccountDisabled => "Account disabled".to_owned(),
HistoryEntry::AccountEnabled => "Account re-enabled".to_owned(),
HistoryEntry::AccountViewed => "Account details viewed".to_owned(),
HistoryEntry::AdministratorGranted => "Administrator rights granted".to_owned(),
HistoryEntry::AdministratorRevoked => "Administrator rights removed".to_owned(),
HistoryEntry::HandleChanged => "Handle changed".to_owned(),
Expand Down
5 changes: 4 additions & 1 deletion docs/architecture/database-crate.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,10 @@ the query itself excludes other accounts. `DomainEvent::history_entry` decides
what a user sees. It names every variant, under
`#[deny(clippy::wildcard_enum_match_arm)]`, so a new event cannot be added without
that decision. Ceremonies, rejected attempts, token bookkeeping and invitations
are hidden; admin and CLI actions show with the kind of actor, never the operator.
are hidden; admin and CLI changes show with the kind of actor, never the operator.
An administrator's views of the account are hidden too: a read may be a misclick
or a confidential inquiry, so the owner sees changes, each with its reason, and
only the audit keeps the views.

`POST /account/history/{event_id}/report` reports an entry the user caused as not
theirs. One transaction records `CompromiseReported`, ends the account's other
Expand Down
3 changes: 2 additions & 1 deletion docs/architecture/surfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ When an administrator or operator acts:
each event as personal data, and the owner sees it in their security history,
next to "By a Piquel administrator".
- Events record the administrator or operator as their actor. A page's reads are
recorded as one view of the account, as `user show` is.
recorded as one view of the account, as `user show` is. The owner's history
leaves views out: it shows changes, with their reasons, not reads.
- An administrator may not change another administrator's account: it is refused
before waiting for the account lock and again under it. A change checks the
administrator's rights, session and passkey confirmation once more before it
Expand Down
Loading