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

Update protobuf #2666

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ethpm/_utils/ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Descriptor,
)

from ethpm._utils.protobuf.ipfs_file_pb2 import (
from ethpm._utils.protobuf.ipfs_file_pb2 import ( # type: ignore
Data,
PBNode,
)
Expand Down Expand Up @@ -91,8 +91,7 @@ def serialize_bytes(file_bytes: bytes) -> Descriptor:
file_size = len(file_bytes)

data_protobuf = Data(
# type ignored b/c DataType is manually attached in ipfs_file_pb2.py
Type=Data.DataType.Value("File"), # type: ignore
Type=Data.DataType.Value("File"),
Data=file_bytes,
filesize=file_size,
)
Expand Down
327 changes: 20 additions & 307 deletions ethpm/_utils/protobuf/ipfs_file_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions ethpm/assets/ipfs_file.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* This file will generate ipfs_file_pb2.py when invoked on the command line via: */
/* $ protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/ipfs_file.proto */
/* in this case: */
/* $ protoc -I=ethpm/assets --python_out=ethpm/_utils/protobuf ethpm/assets/ipfs_file.proto */

syntax = "proto3";

message Data {
enum DataType {
Raw = 0;
Directory = 1;
File = 2;
Metadata = 3;
Symlink = 4;
}

DataType Type = 1;
optional bytes Data = 2;
optional uint64 filesize = 3;
repeated uint64 blocksizes = 4;
}

message PBLink {
optional bytes Hash = 1;
optional string Name = 2;
optional uint64 Tsize = 3;
}

message PBNode {
repeated PBLink Links = 2;
optional bytes Data = 1;
}
1 change: 1 addition & 0 deletions newsfragments/2666.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Protobuf dependency had a DoS-able bug. It was fixed in v4.21.6. See: https://nvd.nist.gov/vuln/detail/CVE-2022-1941
Loading