ipfs / ipfs/kubo

ipfs pin add does mis-inteprets raw base64 CIDs

Open
#7,739 3 comments 0 reactions 0 assignees View on GitHub
kind/bug need/triage
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

#### Description:

The [cid of the welcome-directory](https://ipfs.io/ipfs/bafybeia6po64b6tfqq73lckadrhpihg2oubaxgqaoushquhcek46y3zumm) expressed in base64 is [`mAXASIB57vcD6ZYQ/tYlAHE70HNp1AguaAHUkeFDiIrnsbzRj`](https://cid.ipfs.io/#mAXASIB57vcD6ZYQ/tYlAHE70HNp1AguaAHUkeFDiIrnsbzRj)

This CID, while valid, is interpreted as a path on the cli:
```
ipfs pin add mAXASIB57vcD6ZYQ/tYlAHE70HNp1AguaAHUkeFDiIrnsbzRj
Error: invalid path "mAXASIB57vcD6ZYQ/tYlAHE70HNp1AguaAHUkeFDiIrnsbzRj": length greater than remaining number of bytes in buffer
```

For contrast:
```
ipfs pin add QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc
pinned QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc recursively
```
```
ipfs pin add bafybeia6po64b6tfqq73lckadrhpihg2oubaxgqaoushquhcek46y3zumm
pinned bafybeia6po64b6tfqq73lckadrhpihg2oubaxgqaoushquhcek46y3zumm recursively
```

#### Why is this important / not purely academic?

The default payload-cid (the root CID of the stored DAG) encoding in filecoin is base64, which contains `/` in its character set: https://github.com/filecoin-project/go-fil-markets/blob/v1.0.0/storagemarket/impl/clientutils/clientutils.go#L70

cc @lidel

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.