Skip to content

Commit

Permalink
shrex nd should blacklist peers that send invalid data
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed May 19, 2023
1 parent bd70494 commit 2db5afe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 4 additions & 0 deletions share/getters/shrex.go
Expand Up @@ -211,6 +211,10 @@ func (sg *ShrexGetter) GetSharesByNamespace(
cancel()
switch {
case getErr == nil:
if getErr = nd.Verify(root, id); getErr != nil {
setStatus(peers.ResultBlacklistPeer)
break
}
setStatus(peers.ResultNoop)
sg.metrics.recordNDAttempt(ctx, attempt, true)
return nd, nil
Expand Down
6 changes: 0 additions & 6 deletions share/p2p/shrexnd/client.go
Expand Up @@ -127,12 +127,6 @@ func (c *Client) doRequest(
if err != nil {
return nil, fmt.Errorf("client-nd: converting response to shares: %w", err)
}

err = shares.Verify(root, nID)
if err != nil {
return nil, fmt.Errorf("client-nd: verifying response: %w", err)
}

return shares, nil
}

Expand Down

0 comments on commit 2db5afe

Please sign in to comment.