Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block put with sha2-512 #4577

Closed
richardschneider opened this issue Jan 11, 2018 · 4 comments
Closed

Block put with sha2-512 #4577

richardschneider opened this issue Jan 11, 2018 · 4 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@richardschneider
Copy link

Version information: ipfs version 0.4.13

Type: Bug

Severity: High

Description:

A block put with sha2-512 returns an invalid CID. The returned CID starts with8. This is not a valid multicodec code!

POST http://localhost:5001/api/v0/block/put?mhtype=sha2-512
RSP {"Key":"8Vva8UXUZQVLNqYHCTqwxQg5m6ZrYXGaV731xAoefMjh6GmYbRVuFNadUKuZ8YFCDtx8qirW3BodmzcwG4z1Vg3Wmf","Size":5}
@Stebalien
Copy link
Member

It looks like ipfs is trying to return a CIDv0 with a SHA2-512 hash (invalid). In this case, IPFS can't actually guess the correct IPLD block format (it can with CIDv0 because there's only one) so this command should return an error. (well, really, this shouldn't care about CIDs at all but... https://github.com/ipfs/go-ipfs/issues/4189)

The correct command would have a format=$CODEC parameter.

@Stebalien Stebalien added the kind/bug A bug in existing code (including security flaws) label Jan 11, 2018
@richardschneider
Copy link
Author

So what are the valid $CODEC values. I tried dag-pb and dag-cbor with no luck.

@Stebalien
Copy link
Member

pb, cbor, raw.

@magik6k
Copy link
Member

magik6k commented Jan 11, 2018

Fixed by #4563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

3 participants