From 3037e5eee0285bfdc5f34cdee718331cdb315102 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Wed, 8 Apr 2026 12:25:21 +0000 Subject: [PATCH] db: fix slice aliasing in migration tag merge The migration at db.go:680 appends validated tags to existing tags using append(existingTags, validatedTags...) where existingTags aliases node.Tags. When node.Tags has spare capacity, append writes into the shared backing array, and the subsequent slices.Sort corrupts the original. Clone existingTags before appending to prevent aliasing. --- hscontrol/db/db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hscontrol/db/db.go b/hscontrol/db/db.go index cfc3b789..6e5f73d5 100644 --- a/hscontrol/db/db.go +++ b/hscontrol/db/db.go @@ -677,7 +677,7 @@ AND auth_key_id NOT IN ( continue } - mergedTags := append(existingTags, validatedTags...) + mergedTags := append(slices.Clone(existingTags), validatedTags...) slices.Sort(mergedTags) mergedTags = slices.Compact(mergedTags)