nspcc-dev / neofs-api

NeoFS API documentation and proto files declaration
Apache License 2.0
11 stars 15 forks source link

refs: Prohibit IDs consisting of all zero bytes #303

Closed cthulhu-rider closed 4 months ago

cthulhu-rider commented 4 months ago

i propose to reserve zero IDs and prohibit them from being message fields. While this is a breaking change in theory, in practice nothing will break. At the same time, application development will benefit

cthulhu-rider commented 4 months ago

What if container's hash is all zeros? It a caller is a liar (and that is not a 32 zeros hash), it is easy to check.

we see zeros - we dont hash the container at all. That's the difference

But do we really need to specify it for the fields that are commented as "hash"?

for hash - mb not. But i prefer to explicitly state such cases. For example, although zeros are not a particularly valid hash, the protocol may dictate a special interpretation of them. And so we emphasize that it does not exist

roman-khimov commented 4 months ago

Refs. https://datatracker.ietf.org/doc/html/rfc9562#name-nil-uuid

carpawell commented 4 months ago

@roman-khimov, I have checked UUID generators we used and it is impossible to get zero ID. At the same time, I do not understand what prevents getting zero sha256.

roman-khimov commented 4 months ago

The probability of getting it is rather low. Hash collision between two containers (or objects) is more probable than that and if it happens -- we're toast.