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

Throw when decoding empty Buffers #209

Open
1 task
gmaclennan opened this issue Aug 5, 2024 · 0 comments
Open
1 task

Throw when decoding empty Buffers #209

gmaclennan opened this issue Aug 5, 2024 · 0 comments
Labels

Comments

@gmaclennan
Copy link
Member

gmaclennan commented Aug 5, 2024

There are a few places where we decode buffers in the protobuf message into a hex string, e.g. docId. These could be an empty buffer, which would be invalid.

Anywhere we are decoding a Protobuf type bytes (e.g. that decodes to Buffer), we should assert buf.length > 0. I don't think we should make any other assertions about these fields, to support the most forwards compatibility (e.g. they might be 32 bytes now, but we might change that in the future), so the only thing to check is zero-length.

Related: #115

  • Decoding a versionId, coreDiscoveryKey could be a Buffer of any length. We should check it is length 32.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant