@@ -58,14 +58,14 @@ We include *negative block items* as well, with the idea of enabling denylists
58
58
that are append-only. One of the main operational constraints we have seen is
59
59
that a single item can cause a full denylist to be re-read, re-parsed and
60
60
ultimately need a full restart of the application. We want to avoid that by
61
- providing operators and implementors with the possiblity of just watching
61
+ providing operators and implementors with the possibility of just watching
62
62
denylists for new items without then need to restart anything while new items
63
- are added. This also gives the possiblity of storing an offset and seeking
63
+ are added. This also gives the possibility of storing an offset and seeking
64
64
directly to it after application restarts. * negative block items* can also be
65
65
used to make exceptions to otherwise more general rules.
66
66
67
67
Another aspect that we have maintained in the back of our minds is the
68
- possiblity of sharing lists using IPFS. The append-mostly aspect also plays a
68
+ possibility of sharing lists using IPFS. The append-mostly aspect also plays a
69
69
role here, for lists can be chunked and DAG-ified and only the last chunk will
70
70
change as the file grows. This makes our lists immediately friendly to
71
71
content-addressing and efficient transmission over IPFS. However, the
@@ -75,16 +75,16 @@ this spec.
75
75
Beyond all of that, we put emphasis in making our format easily editable by
76
76
users and facilitating integrations using scripts and with other applications
77
77
(unrelated to the implementation of the parsing/blocking inside IPFS). We
78
- conciously avoid JSON and other machine formats and opt for text and for
78
+ consciously avoid JSON and other machine formats and opt for text and for
79
79
space-delimited items in a grep/sed/cut-friendly way. For example, we expect
80
- that the following should just work accross implementations for adding and
80
+ that the following should just work across implementations for adding and
81
81
blocking something new:
82
82
83
83
```
84
84
echo /ipfs/QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768 >> ~/.config/ipfs/custom.deny
85
85
```
86
86
87
- We conciously avoid defining any other API other than expecting
87
+ We consciously avoid defining any other API other than expecting
88
88
implementations to honor blocking what is on the denylist and act accordingly
89
89
when it is updated. CLI commands or API endpoint to modify list items etc. are
90
90
outside the scope of this spec. Implementations how much information to
@@ -138,7 +138,7 @@ hints:
138
138
# Block IPNS key - blocks wrapped multihash.
139
139
/ipns/k51qzi5uqu5dhmzyv3zac033i7rl9hkgczxyl81lwoukda2htteop7d3x0y1mf
140
140
141
- # Double-hash CID block
141
+ # Double-hash CID block using sha2-256 hashing
142
142
# base58btc-sha256-multihash(QmVTF1yEejXd9iMgoRTFDxBv7HAz9kuZcQNBzHrceuK9HR)
143
143
# Blocks bafybeidjwik6im54nrpfg7osdvmx7zojl5oaxqel5cmsz46iuelwf5acja
144
144
# and QmVTF1yEejXd9iMgoRTFDxBv7HAz9kuZcQNBzHrceuK9HR etc. by multihash
@@ -150,7 +150,7 @@ hints:
150
150
# /ipfs/bafyb4ieqht3b2rssdmc7sjv2cy2gfdilxkfh7623nvndziyqnawkmo266a/path
151
151
# /ipfs/f01701e20903cf61d46521b05f926ba1634628d0bba8a7ffb5b6d5a3ca310682ca63b5ef0/path etc...
152
152
# But not /path2
153
- //QmbK7LDv5NNBvYQzNfm2eED17SNLt1yNMapcUhSuNLgkqz
153
+ //gW813G35CnLsy7gRYYHuf63hrz71U1xoLFDVeV7actx6oX
154
154
155
155
# Legacy CID double-hash block
156
156
# sha256(bafybeiefwqslmf6zyyrxodaxx4vwqircuxpza5ri45ws3y5a62ypxti42e/)
@@ -184,7 +184,6 @@ Comment lines start with `#`. Empty lines are allowed.
184
184
185
185
Lines should not be longer than 2MiB including the "\n" delimiter.
186
186
187
-
188
187
### Header
189
188
190
189
The list header is an optional YAML block.
@@ -273,7 +272,7 @@ Blocking layer recommendation: PathResolver.
273
272
#### ` /ipfs/CID/PATH* `
274
273
275
274
IPFS-Path-Prefix-Rule: Blocks any multihash-path combination starting with the
276
- the given path prefix. ` /* ` includes the empty path. Thus ` /ipfs/CID/* `
275
+ given path prefix. ` /* ` includes the empty path. Thus, ` /ipfs/CID/* `
277
276
blocks the CID itself, and any paths. Examples:
278
277
279
278
- ` /ipfs/CID/* ` : blocks CID (by multihash) and any path BEFORE resolving.
@@ -301,7 +300,7 @@ When the rule `/ipfs/CID` exists and BlockService-level blocking
301
300
IPNS-rule: Blocks the given IPNS name before resolving. It does not block the CID that it
302
301
resolves to.
303
302
304
- If the IPNS ` NAME ` is a domain name, it is blocked directy .
303
+ If the IPNS ` NAME ` is a domain name, it is blocked directly .
305
304
306
305
If the IPNS ` NAME ` is a CIDv1 (libp2p-key) or b58-encoded-multihash (CIDV0),
307
306
then the blocking affects the underlying Multihash.
@@ -380,8 +379,8 @@ In order to check for a matching rule, the PathResolver working with `/ipfs/CID/
380
379
- (legacy) Convert the CID to CIDv1Base32 and hash ` CIDV1BASE32/PATH ` with the
381
380
hashing functions used in the denylist. Match against declared double-hashes.
382
381
An empty path means that the value to hash is ` CIDV1BASE32/ ` (with the
383
- trailing slash). This is the legacy hashing so the hashing function is
384
- usually sha256 and the matched rules are legacy badbits anchor rules.
382
+ trailing slash). This is the legacy hashing, the function is
383
+ sha256 and the matched rules are legacy badbits anchor rules.
385
384
386
385
The NameSystem (used only for ` /ipns/* ` ) should:
387
386
@@ -399,24 +398,27 @@ The "modern" double-hashed items (b58-encoded-multihash) can be created with
399
398
existing CLI tools like
400
399
[ Kubo] ( https://docs.ipfs.tech/how-to/command-line-quick-start/ ) :
401
400
401
+ Convert any CID to its multihash with:
402
+
402
403
```
403
- $ printf "QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768/my/path" | ipfs add --raw-leaves --only-hash --quiet | ipfs cid format -f '%M' -b base58btc
404
- QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8
404
+ $ ipfs cid format -f '%M' -b base58btc bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze
405
+ QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768
405
406
```
406
407
407
- The rule ` //QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8 ` will block
408
- ` /ipfs/bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze/my/path ` ,
409
- with ` QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8 ` being the base58-encoded
410
- multihash contained in
411
- ` bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze ` .
412
-
413
- We can convert any CID to its multihash with:
408
+ Then, create a second multihash to be used in ` //DOUBLE-HASH ` rule that will be
409
+ blocking specific content path under the extracted multihash:
414
410
415
411
```
416
- $ ipfs cid format -f '%M' -b base58btc bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze
417
- QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768
412
+ $ printf "QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768/my/path" | ipfs block put --mhtype sha2-256 | ipfs cid format -f '%M' -b base58btc
413
+ QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8
418
414
```
419
415
416
+ The double-hash rule ` //QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8 ` will block
417
+ ` /ipfs/bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze/my/path ` .
418
+
419
+ The ` QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768 ` is the multihash contained
420
+ in ` bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze ` .
421
+
420
422
:::
421
423
422
424
#### Negated rules
@@ -517,7 +519,6 @@ detail.
517
519
518
520
In particular, a reference [ Blocker implementation validator] ( https://github.com/ipfs-shipyard/nopfs/tree/master/tester ) is provided in Go, and can be adapted to other languages if needed.
519
521
520
-
521
522
### Implementations
522
523
523
524
- [ NOpfs] ( https://github.com/ipfs-shipyard/nopfs ) : An implementation of IPIP-383 which add supports for content blocking to the go-ipfs stack and particularly to [ Kubo] ( https://github.com/ipfs/kubo ) .
0 commit comments