Skip to content

Commit 79bfdc7

Browse files
committed
ipip-383: publish the spec on the website
1 parent 1f88145 commit 79bfdc7

File tree

3 files changed

+97
-72
lines changed

3 files changed

+97
-72
lines changed

src/compact-denylist-format.md

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
1-
# Compact Denylist Format specification
2-
3-
![wip](https://img.shields.io/badge/status-wip-orange.svg?style=flat-square)
4-
5-
**Author(s)**:
6-
- @hsanjuan
7-
8-
**Maintainer(s)**:
9-
- @hsanjuan
10-
11-
* * *
12-
13-
**Abstract**
14-
15-
This is the specification for [compact denlylist format V1](IPIP/383-compact-denylist-format.md).
1+
---
2+
title: Compact Denylist Format
3+
description: >
4+
How content blocking rules can be represented as a .deny file.
5+
date: 2023-10-25
6+
maturity: reliable
7+
editors:
8+
- name: Hector Sanjuan
9+
github: hsanjuan
10+
affiliation:
11+
name: Protocol Labs
12+
url: https://protocol.ai/
13+
tags: ['filtering']
14+
order: 1
15+
---
1616

1717
Denylists provide a way to indicate what content should be blocked by IPFS.
1818

19-
## Organization of this document
20-
21-
- [Introduction](#introduction)
22-
- [Specification](#specification)
23-
- [Denylist File extension, locations and order](#denylist-file-extension-locations-and-order)
24-
- [Denylist format](#denylist-format)
25-
- [Test fixtures](#test-fixtures)
26-
- [Security](#security)
27-
- [Privacy and User Control](#privacy-and-user-control)
28-
- [Implementations](#implementations)
29-
3019
## Introduction
3120

3221
A denylist is a collection of items that will be "blocked" on IPFS software.
@@ -55,8 +44,8 @@ done in the future to support specific features.
5544
The denylist itself, after the header, is a collection of **block items** and
5645
block-item-specific hints. There are different flavours of block items,
5746
depending on whether we are blocking by CID, CID+path, Path, IPNS, using
58-
double-hashing etc. but the idea is that whether an item is blocked or not can
59-
be decided directly and ideally, prior to retrieval.
47+
double-hashing etc. but the idea is that whether an item is blocked or not
48+
SHOULD be decided directly and ideally, _prior to retrieval_.
6049

6150
We include *negative block items* as well, with the idea of enabling denylists
6251
that are append-only. One of the main operational constraints we have seen is
@@ -111,9 +100,9 @@ in future versions.
111100

112101
While not pertaining to the denylist format itself, we introduce the following conventions about denylist files when they are stored in the local filesystem:
113102

114-
- Denylist files are named with the extension `.deny`.
115-
- Implementations should look in `/etc/ipfs/denylists/` and
116-
`$XDG_CONFIG_HOME/ipfs/denylists/` for denylist files.
103+
- Denylist files MUST be named with the extension `.deny`.
104+
- Implementations SHOULD look in `/etc/ipfs/denylists/` and
105+
`$XDG_CONFIG_HOME/ipfs/denylists/` (default: `~/.config/ipfs/denylists`) for denylist files.
117106
- Denylist files are processed in alphabetical order so that rules from later
118107
denylists override rules from earlier denylists on conflict.
119108

@@ -123,7 +112,7 @@ While not pertaining to the denylist format itself, we introduce the following c
123112

124113
The following example showcases the features and syntax of a compact denylist:
125114

126-
```
115+
```yaml
127116
version: 1
128117
name: IPFSCorp blocking list
129118
description: A collection of bad things we have found in the universe
@@ -132,7 +121,7 @@ hints:
132121
hint: value
133122
hint2: value2
134123
---
135-
# Blocking by CID - blocks wrapped multihash.
124+
# Blocking by CID is codec-agnostic (blocks by multihash).
136125
# Does not block subpaths per se, but might stop an implementation
137126
# from resolving subpaths if this block is not retrievable.
138127
/ipfs/bafybeihvvulpp4evxj7x7armbqcyg6uezzuig6jp3lktpbovlqfkuqeuoq
@@ -160,42 +149,43 @@ hints:
160149
/mime/image/*
161150
!/mime/image/gif
162151

163-
# Legacy CID double-hash block
164-
# sha256(bafybeiefwqslmf6zyyrxodaxx4vwqircuxpza5ri45ws3y5a62ypxti42e/)
165-
# blocks only this CID
166-
//d9d295bde21f422d471a90f2a37ec53049fdf3e5fa3ee2e8f20e10003da429e7
167-
168-
# Legacy Path double-hash block
169-
# Blocks bafybeiefwqslmf6zyyrxodaxx4vwqircuxpza5ri45ws3y5a62ypxti42e/path
170-
# but not any other paths.
171-
//3f8b9febd851873b3774b937cce126910699ceac56e72e64b866f8e258d09572
172-
173-
# Double hash CID block
152+
# Double-hash CID block
174153
# base58btc-sha256-multihash(QmVTF1yEejXd9iMgoRTFDxBv7HAz9kuZcQNBzHrceuK9HR)
175154
# Blocks bafybeidjwik6im54nrpfg7osdvmx7zojl5oaxqel5cmsz46iuelwf5acja
176155
# and QmVTF1yEejXd9iMgoRTFDxBv7HAz9kuZcQNBzHrceuK9HR etc. by multihash
177156
//QmX9dhRcQcKUw3Ws8485T5a9dtjrSCQaUAHnG4iK9i4ceM
178157

179-
# Double hash Path block using blake3 hashing
158+
# Double-hash Path block using blake3 hashing
180159
# base58btc-blake3-multihash(gW7Nhu4HrfDtphEivm3Z9NNE7gpdh5Tga8g6JNZc1S8E47/path)
181160
# Blocks /ipfs/bafyb4ieqht3b2rssdmc7sjv2cy2gfdilxkfh7623nvndziyqnawkmo266a/path
182161
# /ipfs/bafyb4ieqht3b2rssdmc7sjv2cy2gfdilxkfh7623nvndziyqnawkmo266a/path
183162
# /ipfs/f01701e20903cf61d46521b05f926ba1634628d0bba8a7ffb5b6d5a3ca310682ca63b5ef0/path etc...
184163
# But not /path2
185164
//QmbK7LDv5NNBvYQzNfm2eED17SNLt1yNMapcUhSuNLgkqz
165+
166+
# Legacy CID double-hash block
167+
# sha256(bafybeiefwqslmf6zyyrxodaxx4vwqircuxpza5ri45ws3y5a62ypxti42e/)
168+
# blocks only this CID
169+
//d9d295bde21f422d471a90f2a37ec53049fdf3e5fa3ee2e8f20e10003da429e7
170+
171+
# Legacy Path double-hash block
172+
# Blocks bafybeiefwqslmf6zyyrxodaxx4vwqircuxpza5ri45ws3y5a62ypxti42e/path
173+
# but not any other paths.
174+
//3f8b9febd851873b3774b937cce126910699ceac56e72e64b866f8e258d09572
175+
186176
```
187177

188178
#### High level list format
189179

190180
A denylist is a UTF-8 encoded text file made of an optional header and a list of blockitems separated by newlines (`\n`). Comment lines start with `#`. Empty lines are allowed.
191181

192-
```
193-
<header>
182+
```yaml
183+
[yaml_header]
194184
---
195-
<block_item1> [hint_list]
185+
[block_item1] [optional_hint_list]
196186

197187
# comment
198-
<block_item2> [hint_list]
188+
[block_item2] [optional_hint_list]
199189
...
200190
```
201191

@@ -240,13 +230,13 @@ should attempt parsing the header as YAML:
240230

241231
#### Hints
242232

243-
A *hint* is a key-value duple associated to a \<block_item\>. the denylist as
244-
a whole (part of the header), or to a specific \<block_item\>.
233+
A *hint* is a key-value duple associated to a `[block_item]`. the denylist as
234+
a whole (part of the header), or to a specific `[block_item]`.
245235

246-
A list of hints can optionally follow every \<block_item\> as show
236+
A list of hints can optionally follow every `[block_item]` as show
247237
above. Hints can also be specified in the denylist header ("header
248238
hints"). This is equivalent to adding the same hints to every single
249-
\<block_item\> in the denylist. Implementations should associate both the
239+
`[block_item]` in the denylist. Implementations should associate both the
250240
specific and the header hints to every block rule.
251241

252242
#### List body
@@ -281,8 +271,11 @@ the CID itself.
281271
Blocking layer recommendation: BlockService (or PathResolver if wanting to
282272
block by path only).
283273

284-
**NOTE**: See note in `/ipfs/CID/*` below, as to why this rule may effectively
285-
block all subpaths too.
274+
:::warning
275+
276+
See note in `/ipfs/CID/*` below, as to why this rule may effectively block all subpaths too.
277+
278+
:::
286279

287280
##### `/ipfs/CID/PATH`
288281

@@ -306,7 +299,9 @@ blocks the CID itself, and any paths. Examples:
306299

307300
Blocking layer recommendation: PathResolver
308301

309-
**NOTE**: When the rule `/ipfs/CID` exists and BlockService-level blocking
302+
:::warning
303+
304+
When the rule `/ipfs/CID` exists and BlockService-level blocking
310305
exists, subpaths of CID will effectively be blocked in the process of being
311306
resolved, as we would disallow fetching the root CID, even if the subpath
312307
itself is not block. This causes `/ipfs/CID` to behave like
@@ -316,6 +311,7 @@ Blocking layer recommendation: PathResolver
316311
part of the resolution of a subpath that is not blocked. Implementations can
317312
decide which model they want to adopt.
318313

314+
:::
319315

320316
##### `/ipns/IPNS`
321317

@@ -423,6 +419,8 @@ The BlockService should:
423419

424420
#### Allow (or negated) rules
425421

422+
The specification syntax examples describe a `.deny` list of items to block (deny).
423+
426424
Block items can be prepended by `!`, which means that items matching the rule are to be allowed rather than blocked.
427425

428426
This can be used to undo existing rules, but also to add concrete exceptions to wider rules. Order matters, and Allow rules must come AFTER other existing rules.
@@ -446,12 +444,19 @@ Examples:
446444
In this example, `/ipns/my.domain` stays blocked because the deny rule happens
447445
AFTER the allow one.
448446

447+
:::note
448+
449+
Implementations MAY reuse denylist format for `.allow` files, where everything
450+
is blocked by default, and only matching items are allowed.
451+
452+
:::
453+
449454
#### Hint list
450455

451456
A hint list is an optional space-separated list of hints associated with specific block items in the form:
452457

453458
```
454-
<block_item> hintA:v1 hintB:v2 hintC:v3
459+
[block_item] hintA:v1 hintB:v2 hintC:v3
455460
```
456461

457462
Block items and hints are separated by one or more consecutive instances of
@@ -464,7 +469,7 @@ Denylist parsing and correct behaviour can be tested using the
464469
denylist, which provides example rules and describes the expected behaviour in
465470
detail.
466471

467-
In particular, a [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.
472+
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.
468473

469474
### Security
470475

src/index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h3><a href="/http-gateways/">HTTP Gateways</a></h3>
8888
{% include 'list.html', posts: collections.httpGateways %}
8989
</section>
9090
<section>
91-
<h3><a href="/ipns/">InterPlanetary Naming System</a></h3>
91+
<h3><a href="/ipns/">IPNS</a></h3>
9292
<p>
9393
The InterPlanetary Naming System (IPNS) is a naming system responsible for creating, reading and updating mutable pointers to data.
9494
</p>
@@ -98,10 +98,17 @@ <h3><a href="/ipns/">InterPlanetary Naming System</a></h3>
9898
<h3><a href="/routing/">Routing</a></h3>
9999
<p>
100100
Content routing is the way to determine where to find a given CID on the network;
101-
specifically, which network peers provide specific CIDs.
101+
specifically, which network peers provide specific CIDs.
102102
</p>
103103
{% include 'list.html', posts: collections.routing %}
104104
</section>
105+
<section>
106+
<h3>Content Filtering</h3>
107+
<p>
108+
How IPFS service operators can control the content hosted on their nodes.
109+
</p>
110+
{% include 'list.html', posts: collections.filtering %}
111+
</section>
105112
<section>
106113
<h3><a href="/ipips/">InterPlanetary Improvement Proposals</a></h3>
107114
<p>

src/ipips/ipip-0383.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
# IPIP-383: Compact denylist format
2-
3-
- Start Date: 2023-03-09
4-
- Related Issues:
5-
- A different proposal: https://github.com/ipfs/specs/pull/340
1+
---
2+
title: "IPIP-0383: Compact Denylist Format"
3+
date: 2023-03-09
4+
ipip: proposal
5+
editors:
6+
- name: Hector Sanjuan
7+
github: hsanjuan
8+
affiliation:
9+
name: Protocol Labs
10+
url: https://protocol.ai/
11+
relatedIssues:
12+
- https://github.com/ipfs/specs/issues/298
13+
- https://github.com/ipfs/specs/pull/299
14+
- https://github.com/ipfs/specs/pull/340
15+
order: 383
16+
tags: ['ipips']
17+
---
618

719
## Summary
820

921
This IPIP introduces a line-based denylist format for content blocking on IPFS
1022
focused on simplicity, scalability and ease-of-use.
1123

12-
A reference Go implementation of a denylist parser and Blocker component for the Go-IPFS stack exists at https://github.com/ipfs-shipyard/nopfs.
24+
A reference Go implementation of a denylist parser and Blocker component for
25+
the Kubo (go-ipfs) stack exists at https://github.com/ipfs-shipyard/nopfs.
1326

1427
## Motivation
1528

@@ -23,7 +36,7 @@ can rely on and share.
2336

2437
## Detailed design
2538

26-
See [Compact Denylist Format](../COMPACT_DENYLIST_FORMAT.md).
39+
See :cite[compact-denylist-format].
2740

2841
## Design rationale
2942

@@ -51,7 +64,7 @@ The proposed design is part of a holistic approach to content-moderation for IPF
5164
- Ability to block based on CID codec (only allow Codec X)
5265
- Ability to block based on multihash function (”no identity multihashes”)
5366
- Ability to block IPNS names
54-
67+
5568
- Regarding the lists:
5669
- Compact format, compression friendly
5770
- Line-based so that updates can be watched
@@ -66,7 +79,7 @@ The proposed design is part of a holistic approach to content-moderation for IPF
6679
- Lists support gateway http error hints (i.e. type of block)
6780
- `echo "/ipfs/cid" >> ~/.config/ipfs/denylists/custom` should work
6881
- Lists have a header section with information about the list.
69-
82+
7083
- Regarding the implementation:
7184
- Multiple denylists should be supported
7285
- Hot-reloading of list (no restart of IPFS required)
@@ -96,9 +109,9 @@ Users and developers will benefit from a list format that is easy to work with b
96109

97110
### Compatibility
98111

99-
The current Protocol Labs denylist format
100-
https://badbits.dwebops.pub/denylist.json can be easily converted into the
101-
proposed compact format. This is shown at https://badbits.dwebops.pub/badbits.deny.
112+
The old JSON-based Protocol Labs denylist format
113+
[https://badbits.dwebops.pub/denylist.json](https://web.archive.org/web/20230610082307/https://badbits.dwebops.pub/denylist.json) can be easily converted into the
114+
proposed compact format. This is shown at <https://badbits.dwebops.pub/badbits.deny>.
102115

103116

104117
### Alternatives

0 commit comments

Comments
 (0)