From f55a56fe0cd59427d87059391ea7171feebd9190 Mon Sep 17 00:00:00 2001 From: tom27052006 <83423411+tom27052006@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:04:08 +0100 Subject: [PATCH] Add HTTP auth and policy revocation audit events --- src/api/core/events.rs | 4 ++-- src/api/core/organizations.rs | 2 +- src/api/core/two_factor/mod.rs | 14 +++++++++++--- src/db/models/event.rs | 5 +++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/api/core/events.rs b/src/api/core/events.rs index 0d9f32ad..3b758bb2 100644 --- a/src/api/core/events.rs +++ b/src/api/core/events.rs @@ -214,8 +214,8 @@ async fn post_events_collect(data: Json>, headers: Headers, .await; } } - // Client-side cipher events (viewed, copied, toggled, autofilled). - 1107..=1114 | 1117 | 1119..=1132 => { + // Client-side cipher events (viewed, copied, toggled, autofilled, HTTP auth). + 1107..=1114 | 1117 | 1119..=1133 => { // The cipher determines the organization the event is logged to, so make sure the // user can actually access it instead of trusting the provided cipher uuid. if let Some(cipher_uuid) = &event.cipher_id diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index 6fccc850..6c6d6a06 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -2102,7 +2102,7 @@ async fn put_policy( } log_event( - EventType::OrganizationUserRemoved, + EventType::OrganizationUserRevokedSingleOrganizationNonCompliance, &member.uuid, &org_id, &headers.user.uuid, diff --git a/src/api/core/two_factor/mod.rs b/src/api/core/two_factor/mod.rs index db533b50..cfec98c7 100644 --- a/src/api/core/two_factor/mod.rs +++ b/src/api/core/two_factor/mod.rs @@ -151,7 +151,7 @@ pub async fn enforce_2fa_policy( member.save(conn).await?; log_event( - EventType::OrganizationUserRevoked, + EventType::OrganizationUserRevokedTwoFactorNonCompliance, &member.uuid, &member.org_uuid, act_user_id, @@ -185,8 +185,16 @@ pub async fn enforce_2fa_policy_for_org( member.revoke(); member.save(conn).await?; - log_event(EventType::OrganizationUserRevoked, &member.uuid, org_id, act_user_id, device_type, ip, conn) - .await; + log_event( + EventType::OrganizationUserRevokedTwoFactorNonCompliance, + &member.uuid, + org_id, + act_user_id, + device_type, + ip, + conn, + ) + .await; } } diff --git a/src/db/models/event.rs b/src/db/models/event.rs index 8dc3a5ad..e020bb3d 100644 --- a/src/db/models/event.rs +++ b/src/db/models/event.rs @@ -79,6 +79,7 @@ pub enum EventType { CipherSoftDeleted = 1115, CipherRestored = 1116, CipherClientToggledCardNumberVisible = 1117, + CipherClientHttpAuthReleased = 1133, // Collection CollectionCreated = 1300, @@ -111,8 +112,8 @@ pub enum EventType { // OrganizationUserAutomaticallyConfirmed = 1517, // OrganizationUserSelfRevoked = 1518, // User self-revoked due to declining organization data ownership policy OrganizationUserAdminResetTwoFactor = 1519, - // OrganizationUserRevoked_TwoFactorNonCompliance = 1520, - // OrganizationUserRevoked_SingleOrganizationNonCompliance = 1521, + OrganizationUserRevokedTwoFactorNonCompliance = 1520, + OrganizationUserRevokedSingleOrganizationNonCompliance = 1521, OrganizationUserNotificationBannerActionClicked = 1522, // Organization