Bug 1462565

Summary: RPMs >4GB are not supported with the sign-rpms wire protocol
Product: [Fedora] Fedora EPEL Reporter: Patrick Uiterwijk <puiterwijk>
Component: sigulAssignee: Patrick Uiterwijk <puiterwijk>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: mitr, puiterwijk
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-09 11:24:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Patrick Uiterwijk 2017-06-18 23:19:20 UTC
The current wire protocol encodes the payload size as a 32-bit unsigned integer.
This means that if an RPM is larger than 4GB, it cannot be encoded and the signing fails.

The exception:
Traceback (most recent call last):
  File "/usr/share/sigul/utils.py", line 681, in run
    self._real_run()
  File "/usr/share/sigul/bridge.py", line 693, in _real_run
    self.__handle_one_rpm(rpm)
  File "/usr/share/sigul/bridge.py", line 713, in __handle_one_rpm
    self.__server_buf.write(utils.u32_pack(payload_size))
  File "/usr/share/sigul/utils.py", line 201, in u32_pack
    return struct.pack(_u32_format, v)
error: 'I' format requires 0 <= number <= 4294967295

Fixing this probably requires a change to the wire protocol details for the sign-rpms call.

This was found due to #1456261.

Comment 1 Patrick Uiterwijk 2017-06-19 06:09:21 UTC
Funny detail: this was already marked as FIXME in the protocol design:

** u32 L payload length
   The payload length limit is request-specific.
   FIXME: should be u64?

I don't think there's a sane way to fix this without bumping the protocol_version, so I guess we will just raise this to u64 and increase protocol_version to 1.

This does mean we will need to add the code to the bridge to check the servers' protocol_version, which the code currently mentions as not implemented, which so far with a single protocol version wasn't such a big deal.

I think I'm going to combine this with the moving of signature stripping to the server for the koji case (https://bugzilla.redhat.com/show_bug.cgi?id=1367568#c3).

Comment 2 Patrick Uiterwijk 2020-06-09 11:24:02 UTC
This is now fixed in Sigul v1.0, of which Alpha 1 is now released and built in Rawhide.