[PR #2569] [MERGED] [management] Add GCM encryption and migrate legacy encrypted events #19939

Open
opened 2026-08-05 05:06:39 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2569
Author: @bcmmbaga
Created: 9/10/2024
Status: Merged
Merged: 9/11/2024
Merged by: @bcmmbaga

Base: mainHead: fix/random-iv-encryption


📝 Commits (7)

  • d004132 Add AES-GCM encryption
  • 7690459 migrate legacy encrypted data to AES-GCM encryption
  • 150a1e5 Refactor and use transaction when migrating data
  • f455cc6 Add events migration tests
  • 72896ca fix lint
  • 0aff059 skip migrating record on error
  • 62db0eb Preallocate capacity for nonce to avoid allocations in Seal

📊 Changes

5 files changed (+396 additions, -86 deletions)

View changed files

📝 management/server/activity/sqlite/crypt.go (+47 -2)
📝 management/server/activity/sqlite/crypt_test.go (+36 -2)
management/server/activity/sqlite/migration.go (+157 -0)
management/server/activity/sqlite/migration_test.go (+84 -0)
📝 management/server/activity/sqlite/sqlite.go (+72 -82)

📄 Description

Describe your changes

This PR updates the encryption scheme for events data from the legacy CBC encryption with a static IV to the GCM (Galois/Counter Mode) encryption.

Closes #2246

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/2569 **Author:** [@bcmmbaga](https://github.com/bcmmbaga) **Created:** 9/10/2024 **Status:** ✅ Merged **Merged:** 9/11/2024 **Merged by:** [@bcmmbaga](https://github.com/bcmmbaga) **Base:** `main` ← **Head:** `fix/random-iv-encryption` --- ### 📝 Commits (7) - [`d004132`](https://github.com/netbirdio/netbird/commit/d004132b30e2ef5db8da01750c2cbf9399b67c71) Add AES-GCM encryption - [`7690459`](https://github.com/netbirdio/netbird/commit/7690459f3f3c23de5575f87b0d3a395dae267256) migrate legacy encrypted data to AES-GCM encryption - [`150a1e5`](https://github.com/netbirdio/netbird/commit/150a1e5141b88c15307982a59ea9fef3360b5002) Refactor and use transaction when migrating data - [`f455cc6`](https://github.com/netbirdio/netbird/commit/f455cc6e5d97482fdac7a092fa823154ba3cd139) Add events migration tests - [`72896ca`](https://github.com/netbirdio/netbird/commit/72896ca3c8b312831fa9c5b0e0c04a78d46186f2) fix lint - [`0aff059`](https://github.com/netbirdio/netbird/commit/0aff05942a1bc20e47f3c2ff1e4067d442766053) skip migrating record on error - [`62db0eb`](https://github.com/netbirdio/netbird/commit/62db0ebd2a85b6acc0bdc57e0c6b33d001b3013a) Preallocate capacity for nonce to avoid allocations in Seal ### 📊 Changes **5 files changed** (+396 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `management/server/activity/sqlite/crypt.go` (+47 -2) 📝 `management/server/activity/sqlite/crypt_test.go` (+36 -2) ➕ `management/server/activity/sqlite/migration.go` (+157 -0) ➕ `management/server/activity/sqlite/migration_test.go` (+84 -0) 📝 `management/server/activity/sqlite/sqlite.go` (+72 -82) </details> ### 📄 Description ## Describe your changes This PR updates the encryption scheme for events data from the legacy CBC encryption with a static IV to the GCM (Galois/Counter Mode) encryption. ## Issue ticket number and link Closes #2246 ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] 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 05:06:39 -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#19939