in-toto / apt-transport-in-toto

in-toto transport for apt
Other
8 stars 6 forks source link

Fix newline bug by escaping LF and CR in message #24

Closed lukpueh closed 5 years ago

lukpueh commented 5 years ago

Fixes issue #: Fixes #23

Description of the changes being introduced by the pull request: in-toto has new error messages that contain newline characters. When relaying these messages to apt the text-based protocol breaks. We fix this by escaping any newline character in the message.

NOTE: The apt method interface spec references RFC822, which doesn't allow LF or CR in the message body, except if followed by a LWSP-char (i.e. SPACE or HTAB, for "folding" of long lines). But apt does not seem to support folding, and splits lines only at LF. To be safe we escape LF and CR.

See Transport spec 2.1 Overview and RFC822 "3.1.1. LONG HEADER FIELDS" and "3.1.2. STRUCTURE OF HEADER FIELDS".

Please verify and check that the pull request fulfills the following requirements:

lukpueh commented 5 years ago

@Foxboron, do you want to take a look at the patch and let me know if it's good for merging?

Foxboron commented 5 years ago

Apologizes. I didn't realize you wanted feedback. I applied the patch to my setup and everything works as expected. Thanks!

lukpueh commented 5 years ago

No need to apologize. Thanks for the info. Will merge here.