fix: reset pooled NSScanner RPC responses to avoid stale usage data

NSScanner responses stream either a dataUsageEntry update or the
final dataUsageCache. The grid framework recycles stream responses
into a pool without resetting them, and the handler set only one
field per response - so a recycled response still carried the Final
(or Update) payload of an earlier scan. A remote node reading such a
response accepted the stale final cache, corrupting bucket usage
data across scanner cycles.

Honor Recycler types when pooling stream responses, implement it for
nsScannerResp, and clear the unset field at the response
construction sites for defense in depth.

Signed-off-by: Julien Laurenceau <julien.laurenceau@pepitedata.com>
This commit is contained in:
Julien Laurenceau
2026-10-12 17:02:02 +02:00
parent 00d4a206f7
commit a54d0c4354
4 changed files with 55 additions and 0 deletions
+4
View File
@@ -290,6 +290,9 @@ func (s *storageRESTServer) NSScannerHandler(ctx context.Context, params *nsScan
for update := range updates {
resp := storageNSScannerRPC.NewResponse()
resp.Update = &update
// Pooled responses may carry fields from a previous
// scan, always clear the fields not being set.
resp.Final = nil
out <- resp
}
}()
@@ -301,6 +304,7 @@ func (s *storageRESTServer) NSScannerHandler(ctx context.Context, params *nsScan
// Send final response.
resp := storageNSScannerRPC.NewResponse()
resp.Final = &ui
resp.Update = nil
out <- resp
return nil
}