The zip file format does not indicate what is valid for the contents of the file comment or zipfile comment. In one place, their documentation describes the comment as “textual information,” but in another place the comment is described as “data bytes,” and appnote itself says nothing about what can be done in the comment.
However, even if the specification allows arbitrary binary data in a comment, this does not mean that you should allow it to use your library, and if you decide to allow it, it does not mean that you need to do this easily.
So, here is a list of possible comment processing methods. Choose one.
- Refuse the possibility of using binary data in comments.
- Allow binary data, but refuse to allow a specific signature.
- Allow arbitrary binary data, but require the user to provide some additional confirmation if they try to enable the signature.
- Allow arbitrary binary data, don't worry about the signature.
Of course, for any option where a signature is possible, the documentation should warn the user that this will lead to an invalid ZIP file.
source share