-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
cid-sec: fix bitswap strom caused by insecure CIDs #4946
Conversation
for _, c := range ks { | ||
// hash security | ||
if err := verifcid.ValidateCid(c); err != nil { | ||
log.Errorf("unsafe CID (%s) passed to blockService.GetBlocks: %s", c, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the right solution to this might be to just add a return of a closed block channel after the error here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, a file might have an unsafe block near the end of a file, most of the file should be OK to read. Just the end might be bad.
That is why I sort out the unsafe CIDs and fetch and/or read only the good ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a sharness test be possible?
@Stebalien I will try. |
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
When we introduced CID security we didn't take into account that bitswap might repeatly try getting the objects from the network if it fails putting them into the blockstore. Solution from this is not requesting those objects from bitswap. The proper solution of failing at CID creation will make in much more cleaner in future. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
5a890bd
to
e5ff2c3
Compare
When we introduced CID security we didn't take into account that bitswap
might repeatedly try getting the objects from the network if it fails
putting them into the blockstore.
A solution from this is not requesting those objects from bitswap.
The proper solution of failing at CID creation will make it much more
cleaner in future.
License: MIT
Signed-off-by: Jakub Sztandera kubuxu@protonmail.ch