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

Work around the panic thrown by IntervalDigestFromBytes #20

Closed
Wondertan opened this issue Mar 10, 2021 · 4 comments · Fixed by #22
Closed

Work around the panic thrown by IntervalDigestFromBytes #20

Wondertan opened this issue Mar 10, 2021 · 4 comments · Fixed by #22

Comments

@Wondertan
Copy link
Member

IntervalDigestFromBytes is meant to deserialize bytes commonly received from the wire that does not guarantee to compel with the panic check, allowing a non-valid network message to kill an application that uses the lib. We can either:

  1. Throw an error instead
  2. Force lib user to do an additional check before or recover from panic :)

But obviously, the first one is more preferable.

@Wondertan
Copy link
Member Author

Wondertan commented Mar 10, 2021

@liamsi, If this seems like a valid issue, I would like to resolve it.

I would also suggest keeping the same pattern(data validation in deserializer returning errors) over all the repos to reduce DOS attack vectors.

@liamsi
Copy link
Member

liamsi commented Mar 10, 2021

That's to prevent creating any invalid IntervalDigest object. It's not meant to be used for random messages received from the network. As far as I know it is currently only used in tests. IMO, we could consider deleting it. It has low priority though.

@Wondertan
Copy link
Member Author

It is used here. As an application user, I meant LL core.

That's to prevent creating any invalid IntervalDigest object

I see, however imagine a faulty Node sending a valid protobuf message, but with an empty digest. In such a case the node will panic while returning an error will keep it alive.

@liamsi
Copy link
Member

liamsi commented Mar 10, 2021

You are right! We should fix this then. I'm still wondering if we should remove the interval digest type completely 🤔 OK. let's keep it for now and change it to return an error. Afterwards we should tag another release here and update the dependency in LL core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants