[PR #1133] [MERGED] Extend activity store with deleted emails #16039

Open
opened 2026-08-05 03:08:50 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1133
Author: @pappz
Created: 9/8/2023
Status: Merged
Merged: 9/13/2023
Merged by: @pappz

Base: handle-user-deleteHead: handle-user-delete-activity-log


📝 Commits (10+)

  • 83674e6 Extend activity store with deleted emails
  • 8668c45 Add email format setting in openapi definition
  • 4234afb Code optimisation in events slice
  • 5845d11 Error handling
  • 6221164 Better error handling in GenerateKey
  • 4003328 Fix event copy
  • 9154e7f Revert "Add email format setting in openapi definition"
  • fd19270 Move del user stmt to constructor
  • a6008da Debug test result
  • 23a9d99 Revert store interface modification

📊 Changes

12 files changed (+373 additions, -41 deletions)

View changed files

📝 management/cmd/management.go (+31 -2)
📝 management/server/activity/event.go (+11 -7)
management/server/activity/sqlite/crypt.go (+81 -0)
management/server/activity/sqlite/crypt_test.go (+63 -0)
📝 management/server/activity/sqlite/sqlite.go (+99 -16)
📝 management/server/activity/sqlite/sqlite_test.go (+2 -1)
📝 management/server/config.go (+2 -1)
📝 management/server/http/api/openapi.yml (+5 -0)
📝 management/server/http/api/types.gen.go (+3 -0)
📝 management/server/http/events_handler.go (+45 -11)
📝 management/server/http/events_handler_test.go (+3 -0)
📝 management/server/user.go (+28 -3)

📄 Description

Describe your changes

Store the email address of the deleted user in activity db.
The information will be encrypted with AES.

Refactor the events API endpoint. In the response the arguments
will be extended with the email of the initiator and if relevant then
the email of the target.

  • Add new store encryption key config parameter to the management config.
    The key must to be 32 byte in base64 format.
  • The user delete handler will store the deleted email address in the activity store
  • The get all events handler map the emails based on the user id from the activity store.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/1133 **Author:** [@pappz](https://github.com/pappz) **Created:** 9/8/2023 **Status:** ✅ Merged **Merged:** 9/13/2023 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `handle-user-delete` ← **Head:** `handle-user-delete-activity-log` --- ### 📝 Commits (10+) - [`83674e6`](https://github.com/netbirdio/netbird/commit/83674e682e5c8773aa167e6345f74c8ab0f9d4e8) Extend activity store with deleted emails - [`8668c45`](https://github.com/netbirdio/netbird/commit/8668c454a249038c561d15da56797fe302b9c071) Add email format setting in openapi definition - [`4234afb`](https://github.com/netbirdio/netbird/commit/4234afbca2878f8df2f083930044d930ebc7c89e) Code optimisation in events slice - [`5845d11`](https://github.com/netbirdio/netbird/commit/5845d110a160b3df598ee25f6b2bf1c2f73a5ede) Error handling - [`6221164`](https://github.com/netbirdio/netbird/commit/6221164037f3f9a31260d8378e7ebeacd78d16f4) Better error handling in GenerateKey - [`4003328`](https://github.com/netbirdio/netbird/commit/40033286b15df5d11424a3ff3db8c69d1d45d7ba) Fix event copy - [`9154e7f`](https://github.com/netbirdio/netbird/commit/9154e7fd13184cd84481adeaac99de24f1c4309f) Revert "Add email format setting in openapi definition" - [`fd19270`](https://github.com/netbirdio/netbird/commit/fd19270efb3019d4a5d9a0c4cd54295af0928918) Move del user stmt to constructor - [`a6008da`](https://github.com/netbirdio/netbird/commit/a6008da7462bc2ad3cee3be11c85fe4ad2300a3e) Debug test result - [`23a9d99`](https://github.com/netbirdio/netbird/commit/23a9d99aa48701c7165712a4a40c9ed7624f410b) Revert store interface modification ### 📊 Changes **12 files changed** (+373 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `management/cmd/management.go` (+31 -2) 📝 `management/server/activity/event.go` (+11 -7) ➕ `management/server/activity/sqlite/crypt.go` (+81 -0) ➕ `management/server/activity/sqlite/crypt_test.go` (+63 -0) 📝 `management/server/activity/sqlite/sqlite.go` (+99 -16) 📝 `management/server/activity/sqlite/sqlite_test.go` (+2 -1) 📝 `management/server/config.go` (+2 -1) 📝 `management/server/http/api/openapi.yml` (+5 -0) 📝 `management/server/http/api/types.gen.go` (+3 -0) 📝 `management/server/http/events_handler.go` (+45 -11) 📝 `management/server/http/events_handler_test.go` (+3 -0) 📝 `management/server/user.go` (+28 -3) </details> ### 📄 Description ## Describe your changes Store the email address of the deleted user in activity db. The information will be encrypted with AES. Refactor the events API endpoint. In the response the arguments will be extended with the email of the initiator and if relevant then the email of the target. - Add new store encryption key config parameter to the management config. The key must to be 32 byte in base64 format. - The user delete handler will store the deleted email address in the activity store - The get all events handler map the emails based on the user id from the activity store. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 03:08:50 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#16039