EC streamed GET forwards the remote part-0 parent header without checking it against the requested ID

Aperta
#4,333 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Read pkg/services/object/get.go, especially copyRemotePart, handleGetECPartResponseInit, and the existing checkHeaderProtobufAgainstID calls in the proxy paths. Trace how the requested object ID and parent header reach the streamed response, then check nearby tests for streamed EC GET behavior. Done means a mismatched parent header makes that node fail so another part-0 holder can be tried, with a regression test covering the mismatch.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug neofs-storage

Expected Behavior

When a storage node streams an EC object to a client (full GET, the default path through getECTransport), it forwards the parent header from part 0 only after checking that the header hashes to the requested object ID. The non-streamed paths already do this after #4290.

Current Behavior

copyRemotePart takes the parent ID, signature and header out of a remote node's part-0 response with handleGetECPartResponseInit and writes them straight to the client with writeInitGetResponseBuffers. Nothing compares the header with the requested ID:

  • get.go#L660-L670: parent header from the response goes straight into the client's init message
  • get.go#L810-L860: handleGetECPartResponseInit only reads payload lengths and the LINK type

The proxy paths check this with checkHeaderProtobufAgainstID (get.go#L262, server.go#L2532). #4290 added verifyParentHeaderID to the EC paths in pkg/services/object/get, but the streamed path lives in pkg/services/object/get.go, so it was not covered.

As a result, a container node that answers the part-0 request can make the serving node send another object's header with status OK. The node does not use that header for anything itself, unlike the cases in #4290. A conforming SDK client rejects the header when it checks the ID, but a client that skips checksum verification does not.

The local variant (CopyECParentHeaderAndPayloadFromLocalFirstPart, get.go#L342) reads from the node's own storage, where the part was validated on PUT. It is lower risk, but it has no check either.

Possible Solution

Before writeInitGetResponseBuffers in copyRemotePart, call checkHeaderProtobufAgainstID(parentHdr, x.requestObject, …) and treat a mismatch as a failure of that node, so the next holder of part 0 is tried.

Context

Found while analysing #4326. A payload check on the streamed path has to trust the parent's payload checksum and __NEOFS__EC_PART_HASHES, so it needs this header check first. Static analysis only, no reproduction yet.

Version: 0.58.2 (1f0d51b5d).

Lingua principale
Go
Stelle
37
Fork
56
Merge medio
1g 18h
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nspcc-dev/neofs-node

Tutte le issue di nspcc-dev/neofs-node

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.