[PR #6326] [CLOSED] [client] Migrate profile identity from display name to ID #25421

Open
opened 2026-08-05 07:05:59 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6326
Author: @theodorsm
Created: 6/2/2026
Status: Closed

Base: mainHead: profile-id


📝 Commits (9)

📊 Changes

167 files changed (+2909 additions, -4708 deletions)

View changed files

.github/dependabot.yml (+0 -45)
📝 .github/workflows/check-license-dependencies.yml (+50 -55)
📝 .github/workflows/docs-ack.yml (+1 -1)
📝 .github/workflows/forum.yml (+3 -2)
📝 .github/workflows/git-town.yml (+3 -5)
📝 .github/workflows/golang-test-darwin.yml (+4 -12)
📝 .github/workflows/golang-test-freebsd.yml (+5 -16)
📝 .github/workflows/golang-test-linux.yml (+65 -134)
📝 .github/workflows/golang-test-windows.yml (+9 -10)
📝 .github/workflows/golangci-lint.yml (+5 -9)
📝 .github/workflows/install-script-test.yml (+1 -3)
📝 .github/workflows/mobile-build-validation.yml (+7 -11)
📝 .github/workflows/pr-title-check.yml (+1 -1)
📝 .github/workflows/proto-version-check.yml (+12 -29)
📝 .github/workflows/release.yml (+82 -90)
📝 .github/workflows/sync-main.yml (+2 -2)
📝 .github/workflows/sync-tag.yml (+5 -5)
📝 .github/workflows/test-infrastructure-files.yml (+11 -15)
📝 .github/workflows/update-docs.yml (+4 -4)
📝 .github/workflows/wasm-build-validation.yml (+8 -11)

...and 80 more files

📄 Description

Describe your changes

This PR decouples a profile's identity from its display name. Previously the profile name was used for its on-disk config filename, forcing unique, character-restricted names. Now each profile has a stable ID (the filename) while the name is free-form and stored inside the profile JSON.

Changes

  • IDs: new profiles get a generated 32-char hex ID, legacy profiles keep their name as their ID, so existing files keep working with no migration.

  • Resolution: handles resolve server-side by exact ID > unique ID prefix > unique name. Ambiguous handles return a typed error with candidates.

  • Validation: filename stems are guarded against path traversal and restricted charset (id.go). Display names are UTF-8-validated, control-char stripped, and length-capped.

  • gRPC: Profile, GetActiveProfileResponse, and the Add/Switch/Remove responses gain an additive id field (name retained for older clients).

  • CLI: profile list --show-id adds an ID column: select/remove accept name, ID, or unique prefix, with disambiguation help on ambiguity.
    image

  • UI: the tray client now keys profile operations (switch/remove/logout, config/login requests) on profile ID instead of name, logout confirmation still shows the display name.

  • Android: profile manager updated to the ID model.

Compatibility: fully backward compatible with legacy profiles, existing state files, and older clients all keep working.

Tests: new service_test.go plus updates across profilemanager/server/cmd tests.
OS test: have done manual testing on linux, macos, windows and android as they all use the go implementation of profiles (ios uses a native swift implementation).

Stack

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)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

TODO

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

TODO

Summary by CodeRabbit

  • New Features

    • End-to-end profile IDs: CLI, UI and daemon accept/return stable profile IDs; use --show-id to display them.
  • Improvements

    • Profile commands handle ambiguous names with clearer guidance and ID-prefix resolution; switching/login persist per-profile state by ID.
    • UI/tray and daemon flows use profile IDs. Debug bundles include CLI/daemon version and mask sensitive tokens. Status output shows WireGuard port.
  • Tests

    • Expanded coverage for ID resolution, ambiguity, validation, lifecycle and debug behaviors.

🔄 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/6326 **Author:** [@theodorsm](https://github.com/theodorsm) **Created:** 6/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `profile-id` --- ### 📝 Commits (9) - [`33b1cc5`](https://github.com/netbirdio/netbird/commit/33b1cc5449d6fbc9ac29cc7f42215cfb8e4e5d13) Migrate to profile ids - [`df0717d`](https://github.com/netbirdio/netbird/commit/df0717dc167201ab543c2b68252ba1104c6f4587) Migrate android profile manager - [`6bdbbca`](https://github.com/netbirdio/netbird/commit/6bdbbcad365736de670e35c91f6ffce2d2035066) Clean up - [`c6f003f`](https://github.com/netbirdio/netbird/commit/c6f003fd18a21a759e92b4e8d7745390ba935272) Fix review - [`f98fe1e`](https://github.com/netbirdio/netbird/commit/f98fe1e9ec65f87cf4f9ce46c1ff916c3f56cee9) Add ID type - [`3bb44e7`](https://github.com/netbirdio/netbird/commit/3bb44e72dbb8e762df70f2f50557b5b6c706d32f) Fix test and runes in ShortID() - [`f92bc2d`](https://github.com/netbirdio/netbird/commit/f92bc2d325ea22703d9a3fea2a64f0f79475ead0) Fix profile switch on up and android comments - [`23c82b3`](https://github.com/netbirdio/netbird/commit/23c82b32ff87346e60063aa86468006179ede3db) Revert android profile to string id - [`0a61d7b`](https://github.com/netbirdio/netbird/commit/0a61d7b20e99aa4852d68e996806265d42e14f38) Revert "Merge main" ### 📊 Changes **167 files changed** (+2909 additions, -4708 deletions) <details> <summary>View changed files</summary> ➖ `.github/dependabot.yml` (+0 -45) 📝 `.github/workflows/check-license-dependencies.yml` (+50 -55) 📝 `.github/workflows/docs-ack.yml` (+1 -1) 📝 `.github/workflows/forum.yml` (+3 -2) 📝 `.github/workflows/git-town.yml` (+3 -5) 📝 `.github/workflows/golang-test-darwin.yml` (+4 -12) 📝 `.github/workflows/golang-test-freebsd.yml` (+5 -16) 📝 `.github/workflows/golang-test-linux.yml` (+65 -134) 📝 `.github/workflows/golang-test-windows.yml` (+9 -10) 📝 `.github/workflows/golangci-lint.yml` (+5 -9) 📝 `.github/workflows/install-script-test.yml` (+1 -3) 📝 `.github/workflows/mobile-build-validation.yml` (+7 -11) 📝 `.github/workflows/pr-title-check.yml` (+1 -1) 📝 `.github/workflows/proto-version-check.yml` (+12 -29) 📝 `.github/workflows/release.yml` (+82 -90) 📝 `.github/workflows/sync-main.yml` (+2 -2) 📝 `.github/workflows/sync-tag.yml` (+5 -5) 📝 `.github/workflows/test-infrastructure-files.yml` (+11 -15) 📝 `.github/workflows/update-docs.yml` (+4 -4) 📝 `.github/workflows/wasm-build-validation.yml` (+8 -11) _...and 80 more files_ </details> ### 📄 Description ## Describe your changes This PR decouples a profile's identity from its display name. Previously the profile name was used for its on-disk config filename, forcing unique, character-restricted names. Now each profile has a stable ID (the filename) while the name is free-form and stored inside the profile JSON. Changes - IDs: new profiles get a generated 32-char hex ID, legacy profiles keep their name as their ID, so existing files keep working with no migration. - Resolution: handles resolve server-side by exact ID > unique ID prefix > unique name. Ambiguous handles return a typed error with candidates. - Validation: filename stems are guarded against path traversal and restricted charset (id.go). Display names are UTF-8-validated, control-char stripped, and length-capped. - gRPC: Profile, GetActiveProfileResponse, and the Add/Switch/Remove responses gain an additive id field (name retained for older clients). - CLI: profile list --show-id adds an ID column: select/remove accept name, ID, or unique prefix, with disambiguation help on ambiguity. <img width="1074" height="889" alt="image" src="https://github.com/user-attachments/assets/2fef50f5-97b1-4863-b1ea-0bf038c3c20a" /> - UI: the tray client now keys profile operations (switch/remove/logout, config/login requests) on profile ID instead of name, logout confirmation still shows the display name. - Android: profile manager updated to the ID model. Compatibility: fully backward compatible with legacy profiles, existing state files, and older clients all keep working. Tests: new service_test.go plus updates across profilemanager/server/cmd tests. OS test: have done manual testing on linux, macos, windows and android as they all use the go implementation of profiles (ios uses a native swift implementation). ## Issue ticket number and link ## Stack <!-- branch-stack --> ### 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) - [x] This change does **not** modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — **OR** I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#discuss-changes-with-the-netbird-team-first). > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) TODO ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: TODO <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * End-to-end profile IDs: CLI, UI and daemon accept/return stable profile IDs; use --show-id to display them. * **Improvements** * Profile commands handle ambiguous names with clearer guidance and ID-prefix resolution; switching/login persist per-profile state by ID. * UI/tray and daemon flows use profile IDs. Debug bundles include CLI/daemon version and mask sensitive tokens. Status output shows WireGuard port. * **Tests** * Expanded coverage for ID resolution, ambiguity, validation, lifecycle and debug behaviors. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <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 07:05:59 -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#25421