From de325af4d94b0e09a598edda3ed7e52a1923c4ac Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Sat, 23 May 2026 12:13:43 -0700 Subject: [PATCH] Style Signed-off-by: Bryan Frimin --- .../api/console/v1/dataloader/dataloader.go | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/pkg/server/api/console/v1/dataloader/dataloader.go b/pkg/server/api/console/v1/dataloader/dataloader.go index fac69abdc..5347094b0 100644 --- a/pkg/server/api/console/v1/dataloader/dataloader.go +++ b/pkg/server/api/console/v1/dataloader/dataloader.go @@ -20,8 +20,6 @@ import ( "fmt" "maps" "net/http" - "slices" - "strings" "github.com/vikstrous/dataloadgen" "go.probo.inc/probo/pkg/cookiebanner" @@ -440,39 +438,17 @@ func (f *batchFetcher) fetchAuthorizesIndividually( return result, nil } -// EncodeAuthorizeKeyAttributes returns a canonical (sorted-key) JSON -// encoding of attrs for use as AuthorizeKey.ResourceAttributes. Maps that -// compare equal produce identical strings; nil or empty attrs encode to "". func EncodeAuthorizeKeyAttributes(attrs policy.Attributes) string { if len(attrs) == 0 { return "" } - keys := slices.Sorted(maps.Keys(attrs)) + b, _ := json.Marshal(attrs) - var sb strings.Builder - sb.WriteByte('{') - for i, k := range keys { - if i > 0 { - sb.WriteByte(',') - } - - kb, _ := json.Marshal(k) - sb.Write(kb) - sb.WriteByte(':') - vb, _ := json.Marshal(attrs[k]) - sb.Write(vb) - } - sb.WriteByte('}') - - return sb.String() + return string(b) } func decodeAuthorizeKeyAttributes(s string) (policy.Attributes, error) { - if s == "" { - return nil, nil - } - attrs := policy.Attributes{} if err := json.Unmarshal([]byte(s), &attrs); err != nil { return nil, err