Skip to content

Commit be96b09

Browse files
authored
fix(auth): owners no longer see the address and browser of the administrator who changed their account (#465)
An administrator's or operator's change showed, in the owner's security history and data export, the IP address and browser of the request that made it. Those were the administrator's own, so every owner could see where SourceOrigin's support worked from. Now an owner sees only that an administrator acted, and why. Administrators still see the address and device on the dashboard's event lists and in `audit list`. Follow-up to #438 and #442. Part of #379. ## How `HistoryItem::with` builds every entry the owner reads: the security history page and its JSON, a notification's linked entry, and the events in the data export. For an entry an administrator or operator caused, it now leaves the IP address and device out, and doesn't mark them erased, so the timeline shows nothing in their place. The owner's own entries keep theirs. The admin views build their rows separately (`AdminService::events`), so nothing changes there. The user guides for the security history and the data export say so, and so do `account-deletion.md` and `surfaces.md`. ## Proof `administrators_change_another_account_on_its_behalf` now checks two things in the owner's `/account/history`: - the administrator's entry has no IP address and no device; - the owner's own sign-in keeps its IP address. It fails on main and passes with the fix. `just validate`, `just db test` (449 of 449) and `just docs` pass on this head. Reviewed by Claude Opus 5.5 only: GPT 6.1 Sol is on a usage limit until Nov 13. It approved. It traced every path the owner reads and found the actor reaches the owner only as its kind, never an ID. Its two doc nits are fixed. > [!NOTE] > Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 4ea75df commit be96b09

6 files changed

Lines changed: 41 additions & 15 deletions

File tree

‎apps/auth-service/src/account/tests.rs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ fn reason() -> Reason {
129129
/// An administrator renames and removes another account's passkey and unlinks its
130130
/// identity, with the owner's own operations. Each change is recorded as the
131131
/// administrator's, with the reason as personal data, and the owner sees who
132-
/// acted and why in their history.
132+
/// acted and why in their history, but never the administrator's address or
133+
/// browser.
133134
#[tokio::test]
134135
#[ignore = "requires TEST_DATABASE_URL"]
135136
async fn administrators_change_another_account_on_its_behalf() {
@@ -202,6 +203,19 @@ async fn administrators_change_another_account_on_its_behalf() {
202203
.expect("the rename");
203204
assert_eq!(entry["actor"], "admin");
204205
assert_eq!(entry["reason"], REASON);
206+
// The administrator's own address and browser stay with the admin views; the
207+
// owner's own entries keep theirs.
208+
assert!(
209+
entry["ip"].is_null() && entry["device"].is_null(),
210+
"{entry}"
211+
);
212+
let signed_in = page["entries"]
213+
.as_array()
214+
.expect("entries")
215+
.iter()
216+
.find(|entry| entry["kind"] == "session.signed_in")
217+
.expect("the owner's sign-in");
218+
assert!(!signed_in["ip"].is_null(), "{signed_in}");
205219
}
206220

207221
/// The owner and an administrator change the display name with the same

‎apps/auth-service/src/history/mod.rs‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ pub(crate) struct HistoryItem<E = HistoryEntry> {
7676
pub(crate) reason: Option<String>,
7777
/// The application involved, if any.
7878
pub(crate) client: Option<ClientView>,
79-
/// The request's IP address, while kept.
79+
/// The request's IP address, while kept; never an administrator's or
80+
/// operator's.
8081
pub(crate) ip: Option<IpAddr>,
81-
/// The request's browser and platform, while kept. Entries recorded before
82-
/// platforms were have `other` for theirs.
82+
/// The request's browser and platform, while kept; never an administrator's
83+
/// or operator's. Entries recorded before platforms were have `other` for
84+
/// theirs.
8385
pub(crate) device: Option<UserAgentFamily>,
8486
/// Whether retention or a purge deleted the IP address and device.
8587
pub(crate) erased: bool,
@@ -103,7 +105,9 @@ struct Report {
103105

104106
impl<E> HistoryItem<E> {
105107
/// `stored`, saying what happened with `entry`. `clients` maps client IDs to
106-
/// their names.
108+
/// their names. An administrator's or operator's change shows no IP address
109+
/// or device: they are the administrator's own, which only the admin views
110+
/// show.
107111
pub(crate) fn with(
108112
stored: &StoredEvent,
109113
clients: &BTreeMap<ClientId, String>,
@@ -116,15 +120,17 @@ impl<E> HistoryItem<E> {
116120
name: clients.get(id).cloned(),
117121
id: id.clone(),
118122
});
119-
let (origin, erased) = match &stored.origin {
120-
Personal::Value(origin) => (*origin, false),
121-
Personal::Erased => (RequestOrigin::default(), true),
123+
let actor = HistoryActor::from(&stored.actor);
124+
let (origin, erased) = match (actor, &stored.origin) {
125+
(HistoryActor::Admin | HistoryActor::Operator, _) => (RequestOrigin::default(), false),
126+
(_, Personal::Value(origin)) => (*origin, false),
127+
(_, Personal::Erased) => (RequestOrigin::default(), true),
122128
};
123129
Self {
124130
id: stored.id,
125131
occurred_at: stored.occurred_at,
126132
entry,
127-
actor: HistoryActor::from(&stored.actor),
133+
actor,
128134
reason: stored.reason.clone(),
129135
client,
130136
ip: origin.client_ip,

‎docs/dev/architecture/account-deletion.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ cached. Version 4 holds:
144144
release wrote included, which categories are emailed, and the announcements
145145
it received;
146146
- last, every event about the account as stored (`kind` and `data`), with who
147-
acted, the app, and the request's IP address and device while they are kept.
147+
acted, the app, and the request's IP address and device while they are kept,
148+
unless an administrator or operator acted: theirs stay with the admin views.
148149
Administrators' views of the account are left out, as its history leaves them
149150
out: a read may be a confidential inquiry.
150151

‎docs/dev/architecture/surfaces.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ link, likewise, and confirming with a passkey by the session it confirms.
229229
| OIDC clients (the developer console) | | all; administrators use `AdminService`'s |
230230

231231
Downloading the account's data stays the owner's although administrators may
232-
read most of it: the export copies every IP address and every event about the account out
233-
of auth in one file, which only the owner's recently confirmed session receives.
232+
read most of it: the export copies the account's IP addresses and every event
233+
about it out of auth in one file, which only the owner's recently confirmed
234+
session receives.
234235
Support never hands one over; an owner who lost every passkey is recovered
235236
first, and downloads it themselves.
236237

@@ -241,7 +242,9 @@ When an administrator or operator acts:
241242
alerts and the audit history too. `AdminService` takes it by type, so no
242243
change records an event without one. It is stored with each event as
243244
personal data, and the owner of an account it changes sees it in their
244-
security history, next to "By a SourceOrigin administrator". Announcements
245+
security history, next to "By a SourceOrigin administrator". The owner never
246+
sees who that administrator is, or the IP address and device of their
247+
request: only the dashboard's event lists and `audit list` show them. Announcements
245248
and messages to one account ask for none: their text says why, so sending
246249
one records "See message contents", and a draft's own changes record
247250
nothing.

‎docs/user/account/security-history.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Entries are grouped by day, newest first, with times in UTC. Each says what
1717
happened, such as **Signed in with a passkey** or **Passkey “YubiKey”
1818
added**, then:
1919

20-
- the browser and system it came from, and its network address,
20+
- the browser and system it came from, and its network address, unless
21+
SourceOrigin support made the change,
2122
- the app it went through, as **App:** and the app's name,
2223
- who did it, when it wasn't you: **By a SourceOrigin administrator** or **By a
2324
SourceOrigin operator**, with the reason they gave, **By an app**, or

‎docs/user/your-data/export-your-data.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ downloaded".
4444
announcements you received,
4545
- every event recorded about your account, as stored: what your security
4646
history shows, and also failed sign-ins, passkey confirmations and sign-ins
47-
to apps, with the IP address and browser while they are kept,
47+
to apps, with the IP address and browser while they are kept, except for
48+
changes SourceOrigin support made,
4849
- whether you are an administrator, and since when.
4950

5051
What you removed, such as a passkey or a signed-out device, is in the file

0 commit comments

Comments
 (0)