Skip to content

Commit 990104d

Browse files
authored
docs: add paragraph describing HAMT fanout limit
I came across [this comment](https://github.com/ipfs/boxo/blob/364c5040ec91ec8e2a61446e9921e9225704c34d/ipld/unixfs/hamt/hamt.go#L778) in the boxo source code. It's worth documenting this constant so other implementations don't expose themselves to GHSA-q264-w97q-q778 accidentally.
1 parent c5fa792 commit 990104d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

UNIXFS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ This data is serialized and placed inside the 'Data' field of the outer merkleda
8282

8383
For files comprised of a single block, the 'Type' field will be set to 'File', 'filesize' will be set to the total number of bytes in the file and the file data will be stored in the 'Data' field.
8484

85+
For HAMT Sharded directories the 'Type' field will be set to 'HAMTShard', 'hashType' will be set to a codec value from the [multicodec table](https://github.com/multiformats/multicodec/blob/master/table.csv) and 'fanout' will be set to the bit size of the hash.
86+
87+
Although 'fanout' may have a value of 0-1.8×10^19 it is recommended that implementations limit the values they will accept during deserialization to a smaller number such as 1024 to prevent abuse.
88+
8589
## Metadata
8690

8791
UnixFS currently supports two optional metadata fields:

0 commit comments

Comments
 (0)