Skip to content

Commit

Permalink
refactor: use peer.Decode for now to validate IPNS component
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed May 29, 2023
1 parent d58096f commit c68c5f4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 67 deletions.
4 changes: 2 additions & 2 deletions gateway/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"time"

ipath "github.com/ipfs/boxo/coreiface/path"
"github.com/ipfs/boxo/ipns"
cid "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log"
"github.com/libp2p/go-libp2p/core/peer"
Expand Down Expand Up @@ -380,7 +379,8 @@ func (i *handler) isTrustlessRequest(contentPath ipath.Path, responseFormat stri
}

// Only valid, cryptographically verifiable IPNS record names (no DNSLink on trustless gateways)
if _, err := ipns.Decode(pathComponents[1]); err != nil {
// TODO: replace with ipns.Name as part of https://github.com/ipfs/specs/issues/376
if _, err := peer.Decode(pathComponents[1]); err != nil {
return false
}

Expand Down
37 changes: 0 additions & 37 deletions ipns/name.go

This file was deleted.

28 changes: 0 additions & 28 deletions ipns/name_test.go

This file was deleted.

0 comments on commit c68c5f4

Please sign in to comment.