Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

privacy(telemetry): rotate install identifier

rcourtman39866dba884a
diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md
index 800d898db8..24a570b882 100644
--- a/docs/PRIVACY.md
+++ b/docs/PRIVACY.md
@@ -19,7 +19,7 @@ Every field is listed below — nothing else leaves your server:
| Field | Example | Purpose |
|-------|---------|---------|
-| Install ID | `a1b2c3d4-...` | Random UUID generated locally, not tied to any account |
+| Install ID | `a1b2c3d4-...` | Rotating UUID generated locally, not tied to any account |
| Version | `6.0.0` | Pulse version |
| Platform | `docker` or `binary` | Deployment method |
| OS | `linux` | Operating system |
@@ -48,6 +48,12 @@ Every field is listed below — nothing else leaves your server:
- No alert content, AI prompts, or chat messages
- No personally identifiable information of any kind
+### Install ID rotation
+
+The telemetry install ID is pseudonymous and rotates automatically every 30 days.
+Pulse keeps it only to avoid treating every startup ping as a brand-new install
+while still limiting long-term linkage from one heartbeat window to the next.
+
### Source code
The telemetry implementation is in [`internal/telemetry/telemetry.go`](../internal/telemetry/telemetry.go). You can read the `Ping` struct to see every field that is transmitted.
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index f017c42bad..563a913318 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -131,6 +131,11 @@ such as whether a paid license is active or whether any API tokens exist.
Exact license tiers and exact API-token counts are not part of the canonical
anonymous telemetry contract and may not be reintroduced without updating this
trust boundary and the governed privacy disclosure together.
+That same anonymous telemetry contract also treats `install_id` as a rotating
+pseudonymous identifier, not a lifetime install handle. The runtime may keep a
+local rotating UUID so startup and heartbeat pings can still represent an
+active installation window, but it may not preserve one stable install
+identifier indefinitely or echo that identifier back into routine logs.
That same rule also applies inside shipped security guidance itself:
`SECURITY.md` and the synced `frontend-modern/public/docs/SECURITY.md` copy may
not bounce the operator back to GitHub `main` for section references that the
diff --git a/frontend-modern/public/docs/PRIVACY.md b/frontend-modern/public/docs/PRIVACY.md
index 800d898db8..24a570b882 100644
--- a/frontend-modern/public/docs/PRIVACY.md
+++ b/frontend-modern/public/docs/PRIVACY.md
@@ -19,7 +19,7 @@ Every field is listed below — nothing else leaves your server:
| Field | Example | Purpose |
|-------|---------|---------|
-| Install ID | `a1b2c3d4-...` | Random UUID generated locally, not tied to any account |
+| Install ID | `a1b2c3d4-...` | Rotating UUID generated locally, not tied to any account |
| Version | `6.0.0` | Pulse version |
| Platform | `docker` or `binary` | Deployment method |
| OS | `linux` | Operating system |
@@ -48,6 +48,12 @@ Every field is listed below — nothing else leaves your server:
- No alert content, AI prompts, or chat messages
- No personally identifiable information of any kind
+### Install ID rotation
+
+The telemetry install ID is pseudonymous and rotates automatically every 30 days.
+Pulse keeps it only to avoid treating every startup ping as a brand-new install
+while still limiting long-term linkage from one heartbeat window to the next.
+
### Source code
The telemetry implementation is in [`internal/telemetry/telemetry.go`](../internal/telemetry/telemetry.go). You can read the `Ping` struct to see every field that is transmitted.
diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.go
index e37f81fc81..afab4fdcd1 100644
--- a/internal/telemetry/telemetry.go
+++ b/internal/telemetry/telemetry.go
@@ -7,7 +7,7 @@
// # What is sent (the full list — nothing else)
//
// Identity:
-// - A random install ID (UUID, generated locally, not tied to any account)
+// - A rotating install ID (UUID, generated locally and rotated periodically, not tied to any account)
// - Pulse version
// - Platform: "docker" or "binary"
// - OS and architecture (e.g. "linux/amd64")
@@ -78,13 +78,22 @@ const (
// installIDFile is the filename persisted in the data directory.
installIDFile = ".install_id"
+
+ // installIDRotationWindow limits how long the same pseudonymous identifier
+ // can be reused before it is rotated locally.
+ installIDRotationWindow = 30 * 24 * time.Hour
)
+type installIDRecord struct {
+ InstallID string `json:"install_id"`
+ IssuedAt time.Time `json:"issued_at"`
+}
+
// Ping is the payload sent to the telemetry endpoint.
// Every field is documented here so users can audit exactly what leaves their server.
type Ping struct {
// Identity
- InstallID string `json:"install_id"` // Random UUID, not tied to any account
+ InstallID string `json:"install_id"` // Rotating UUID, not tied to any account
Version string `json:"version"` // Pulse version (e.g. "6.0.0")
Platform string `json:"platform"` // "docker" or "binary"
OS string `json:"os"` // runtime.GOOS (e.g. "linux")
@@ -155,7 +164,7 @@ var (
)
// Start begins anonymous telemetry if enabled.
-// It reads or creates a stable install ID in dataDir, waits for the monitor
+// It reads or creates a rotating install ID in dataDir, waits for the monitor
// to populate state, sends a startup ping, and schedules a daily heartbeat.
// Call Stop() on shutdown.
//
@@ -195,15 +204,9 @@ func Start(ctx context.Context, cfg Config) {
current = r
mu.Unlock()
- // Log only the first 8 chars of the install ID to avoid a stable pseudonymous identifier in logs.
- idPrefix := installID
- if len(idPrefix) > 8 {
- idPrefix = idPrefix[:8] + "…"
- }
log.Info().
- Str("install_id", idPrefix).
Str("platform", platform).
- Msg("Anonymous telemetry enabled — sends install ID, version, platform, OS/arch, resource counts, and feature flags (nothing else)")
+ Msg("Anonymous telemetry enabled — sends a rotating install ID, version, platform, OS/arch, resource counts, and feature flags (nothing else)")
r.wg.Add(1)
go func() {
@@ -292,25 +295,72 @@ func applySnapshot(base Ping, fn SnapshotFunc) Ping {
return ping
}
-// getOrCreateInstallID reads or generates a random install ID in dataDir.
+// getOrCreateInstallID reads or generates a rotating install ID in dataDir.
func getOrCreateInstallID(dataDir string) string {
+ return getOrCreateInstallIDAt(dataDir, time.Now().UTC())
+}
+
+func getOrCreateInstallIDAt(dataDir string, now time.Time) string {
p := filepath.Join(dataDir, installIDFile)
+ now = now.UTC()
data, err := os.ReadFile(p)
if err == nil {
- id := string(bytes.TrimSpace(data))
- if _, err := uuid.Parse(id); err == nil {
- return id
+ record, ok := parseInstallIDRecord(data)
+ if ok && shouldKeepInstallIDRecord(record, now) {
+ return record.InstallID
}
- // Invalid content — regenerate.
}
- id := uuid.New().String()
- if err := os.WriteFile(p, []byte(id+"\n"), 0600); err != nil {
+ record := installIDRecord{
+ InstallID: uuid.New().String(),
+ IssuedAt: now,
+ }
+ encoded, err := json.Marshal(record)
+ if err != nil {
+ log.Warn().Err(err).Msg("Failed to encode rotating install ID")
+ return record.InstallID
+ }
+ if err := os.WriteFile(p, append(encoded, '\n'), 0600); err != nil {
log.Warn().Err(err).Str("path", p).Msg("Failed to persist install ID")
// Still use the generated ID for this session.
}
- return id
+ return record.InstallID
+}
+
+func parseInstallIDRecord(data []byte) (installIDRecord, bool) {
+ trimmed := bytes.TrimSpace(data)
+ if len(trimmed) == 0 {
+ return installIDRecord{}, false
+ }
+
+ var record installIDRecord
+ if err := json.Unmarshal(trimmed, &record); err == nil {
+ record.InstallID = string(bytes.TrimSpace([]byte(record.InstallID)))
+ if _, err := uuid.Parse(record.InstallID); err == nil && !record.IssuedAt.IsZero() {
+ return record, true
+ }
+ return installIDRecord{}, false
+ }
+
+ legacyID := string(trimmed)
+ if _, err := uuid.Parse(legacyID); err == nil {
+ // Legacy plaintext IDs are accepted as migration input only. Rotate to a
+ // new record immediately instead of preserving an unbounded stable ID.
+ return installIDRecord{}, false
+ }
+ return installIDRecord{}, false
+}
+
+func shouldKeepInstallIDRecord(record installIDRecord, now time.Time) bool {
+ if _, err := uuid.Parse(record.InstallID); err != nil {
+ return false
+ }
+ issuedAt := record.IssuedAt.UTC()
+ if issuedAt.IsZero() || issuedAt.After(now) {
+ return false
+ }
+ return now.Sub(issuedAt) < installIDRotationWindow
}
// send posts a ping to the telemetry endpoint. Failures are silently ignored
diff --git a/internal/telemetry/telemetry_test.go b/internal/telemetry/telemetry_test.go
index ffa97aeea2..0adcf144a2 100644
--- a/internal/telemetry/telemetry_test.go
+++ b/internal/telemetry/telemetry_test.go
@@ -12,11 +12,14 @@ import (
"time"
"context"
+
+ "github.com/google/uuid"
)
func TestGetOrCreateInstallID_CreatesNew(t *testing.T) {
dir := t.TempDir()
- id := getOrCreateInstallID(dir)
+ now := time.Date(2026, 3, 28, 12, 0, 0, 0, time.UTC)
+ id := getOrCreateInstallIDAt(dir, now)
if id == "" {
t.Fatal("expected non-empty install ID")
}
@@ -26,19 +29,24 @@ func TestGetOrCreateInstallID_CreatesNew(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if got := string(data); got != id+"\n" {
- t.Fatalf("file content %q does not match returned ID %q", got, id)
+ record := decodeInstallIDRecord(t, data)
+ if record.InstallID != id {
+ t.Fatalf("persisted install ID = %q, want %q", record.InstallID, id)
+ }
+ if !record.IssuedAt.Equal(now) {
+ t.Fatalf("persisted issued_at = %v, want %v", record.IssuedAt, now)
}
}
func TestGetOrCreateInstallID_ReusesExisting(t *testing.T) {
dir := t.TempDir()
+ now := time.Date(2026, 3, 28, 12, 0, 0, 0, time.UTC)
// Create first ID.
- id1 := getOrCreateInstallID(dir)
+ id1 := getOrCreateInstallIDAt(dir, now)
// Second call should return the same ID.
- id2 := getOrCreateInstallID(dir)
+ id2 := getOrCreateInstallIDAt(dir, now.Add(7*24*time.Hour))
if id1 != id2 {
t.Fatalf("expected same ID across calls, got %q and %q", id1, id2)
}
@@ -49,12 +57,42 @@ func TestGetOrCreateInstallID_RegeneratesInvalid(t *testing.T) {
// Write garbage.
os.WriteFile(filepath.Join(dir, installIDFile), []byte("not-a-uuid\n"), 0600)
- id := getOrCreateInstallID(dir)
+ id := getOrCreateInstallIDAt(dir, time.Date(2026, 3, 28, 12, 0, 0, 0, time.UTC))
if id == "" || id == "not-a-uuid" {
t.Fatalf("expected new valid UUID, got %q", id)
}
}
+func TestGetOrCreateInstallID_RotatesExpiredRecord(t *testing.T) {
+ dir := t.TempDir()
+ start := time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC)
+
+ first := getOrCreateInstallIDAt(dir, start)
+ second := getOrCreateInstallIDAt(dir, start.Add(installIDRotationWindow+time.Hour))
+ if first == second {
+ t.Fatalf("expected install ID rotation after %v, got same value %q", installIDRotationWindow, first)
+ }
+}
+
+func TestGetOrCreateInstallID_RotatesLegacyPlaintextID(t *testing.T) {
+ dir := t.TempDir()
+ legacyID := uuid.New().String()
+ if err := os.WriteFile(filepath.Join(dir, installIDFile), []byte(legacyID+"\n"), 0600); err != nil {
+ t.Fatalf("WriteFile: %v", err)
+ }
+
+ now := time.Date(2026, 3, 28, 12, 0, 0, 0, time.UTC)
+ rotated := getOrCreateInstallIDAt(dir, now)
+ if rotated == legacyID {
+ t.Fatalf("expected legacy plaintext install ID to rotate, got same value %q", rotated)
+ }
+
+ record := decodeInstallIDRecordFile(t, filepath.Join(dir, installIDFile))
+ if record.InstallID != rotated {
+ t.Fatalf("persisted install ID = %q, want %q", record.InstallID, rotated)
+ }
+}
+
func TestIsEnabled(t *testing.T) {
tests := []struct {
value string
@@ -253,3 +291,21 @@ func TestStartStop_DisabledByDefault(t *testing.T) {
// Stop should also be safe when nothing was started.
Stop()
}
+
+func decodeInstallIDRecordFile(t *testing.T, path string) installIDRecord {
+ t.Helper()
+ data, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("ReadFile(%s): %v", path, err)
+ }
+ return decodeInstallIDRecord(t, data)
+}
+
+func decodeInstallIDRecord(t *testing.T, data []byte) installIDRecord {
+ t.Helper()
+ var record installIDRecord
+ if err := json.Unmarshal(data, &record); err != nil {
+ t.Fatalf("Unmarshal install ID record: %v", err)
+ }
+ return record
+}