From 2e8954aae0c77f1fb0f779100e1d30a482cb193d Mon Sep 17 00:00:00 2001 From: pingqiu Date: Thu, 19 Nov 2026 00:30:03 -0800 Subject: [PATCH] fix: decode published segment fields strictly --- seaweed-block/core/frontend/chunkstore/manifest.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/seaweed-block/core/frontend/chunkstore/manifest.go b/seaweed-block/core/frontend/chunkstore/manifest.go index 9a4708655d..fa82cae3ce 100644 --- a/seaweed-block/core/frontend/chunkstore/manifest.go +++ b/seaweed-block/core/frontend/chunkstore/manifest.go @@ -165,6 +165,11 @@ func (r *ChunkRemote) resolveManifest(ctx context.Context, h storage.ChunkHead) if err := decodeManifestJSON(body, &doc); err != nil { return h, err } + decoder := json.NewDecoder(bytes.NewReader(body)) + decoder.DisallowUnknownFields() + if err := decoder.Decode(&doc); err != nil { + return h, err + } if doc.Format != 1 || doc.Range != group || doc.ChunkBytes != h.ChunkBytes || doc.Owner != ref.Owner || len(doc.Chunks) != ref.Count { return h, errors.New("chunkstore: invalid segment contents") }