Skip to content

Commit

Permalink
docs: docs/content-blocking.md example
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Oct 28, 2023
1 parent 3d8feac commit d4766b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 12 additions & 1 deletion docs/content-blocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ caused the request to be blocked.

[NOpfs](https://github.com/ipfs-shipyard/nopfs) supports the format from [IPIP-383](https://github.com/ipfs/specs/pull/383).

Example: https://badbits.dwebops.pub/badbits.deny
Clear-text rules are simple: just put content paths to block, one per line.
Paths with unicode and whitespace need to be percend-encoded:

```
/ipfs/QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
/ipfs/bafybeihfg3d7rdltd43u3tfvncx7n5loqofbsobojcadtmokrljfthuc7y/927%20-%20Standards/927%20-%20Standards.png
```

Sensitive content paths can be double-hashed to block without revealing them.
Double-hashed list example: https://badbits.dwebops.pub/badbits.deny

See [IPIP-383](https://github.com/ipfs/specs/pull/383) for detailed format specification and more examples.

## How to suspend blocking without removing denylists

Expand Down
6 changes: 0 additions & 6 deletions test/cli/content_blocking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ func TestContentBlocking(t *testing.T) {
node.StartDaemon() // we need online mode for GatewayOverLibp2p tests
client := node.GatewayClient()

// TODO: run matrix with NoFetch=false|true

// First, confirm gateway works
t.Run("Gateway Allows CID that is not blocked", func(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -174,7 +172,6 @@ func TestContentBlocking(t *testing.T) {
gwTestName := fmt.Sprintf("Gateway denies %s", testCase.name)
t.Run(gwTestName, func(t *testing.T) {
resp := client.Get(testCase.path)
// TODO we should require HTTP 410, not 5XX: assert.Equal(t, http.StatusGone, resp.StatusCode)
assert.Equal(t, http.StatusGone, resp.StatusCode, statusExpl)
assert.Contains(t, resp.Body, blockedMsg, bodyExpl)
})
Expand All @@ -192,7 +189,6 @@ func TestContentBlocking(t *testing.T) {
})

assert.Equal(t, http.StatusGone, resp.StatusCode, statusExpl)
// TODO assert.Equal(t, http.StatusGone, resp.StatusCode)
assert.Contains(t, resp.Body, blockedMsg, bodyExpl)
})

Expand All @@ -205,7 +201,6 @@ func TestContentBlocking(t *testing.T) {
})

assert.Equal(t, http.StatusGone, resp.StatusCode, statusExpl)
// TODO assert.Equal(t, http.StatusGone, resp.StatusCode)
assert.Contains(t, resp.Body, blockedMsg, bodyExpl)
})

Expand All @@ -220,7 +215,6 @@ func TestContentBlocking(t *testing.T) {
})

assert.Equal(t, http.StatusGone, resp.StatusCode, statusExpl)
// TODO assert.Equal(t, http.StatusGone, resp.StatusCode)
assert.Contains(t, resp.Body, blockedMsg, bodyExpl)
})

Expand Down

0 comments on commit d4766b6

Please sign in to comment.