Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Password protected zip files can be rewritten without the password

Closed / Fixedc315de9e44213d74d546088a65512ba797b8e3daCreated 3 years agoUpdated 43 days ago
Descriptionmarkdown2023-09-27 15:16:47

Password protected files are protected from reading but not writing.

% zipfs mount ../tests/zipfiles/test-password.zip [zipfs root]
% set fd [open [file join [zipfs root] cipher.bin]]
decryption failed - no password provided
% set fd [open [file join [zipfs root] cipher.bin] w]
zipfs_14c_1
% puts $fd "new data"
% close $fd
% set fd [open [file join [zipfs root] cipher.bin]]
zipfs_0_2
% gets $fd
new data
% close $fd
Referenced by4
chwplain2023-09-27 16:31:56
Ashok, I've taken the liberty to change the ticket title replacing modified
by rewritten. Why? Since those files can be only written from scratch. 
Modification would require prior knowledge of content which isn't given
due to not having the password for decoding the file.

Which brings us to discussion of the use(full|less)ness of being able to
non-persistently modifying mounted ZIP filesystems. When I added this
(deliberately undocumented) feature I was thinking of temporarily
monkey patching stuff, not to have it as an assured property of the
ZIP filesystem.
apnadkarniplain2023-09-28 11:29:35
Sure, no problem changing the title.

I'm also chewing on the usefulness of a writable zip file system which is not persisted. I feel it would have some uses but is somewhat incomplete at the moment, e.g. write size being limited at open time. Not completely crystallized in my mind as to whether to postpone to a future release or not.

Either way manpages need to be updated to either say zipfs is read-only (and change implementation accordingly) or state the limitations (no new files or directories, size limits etc.)

Still ruminating on what direction to propose ...
chwplain2023-09-28 15:45:03
What about booking this feature under the ::tcl::unsupported::*
category then? And indeed is the ZIPFS unwritable as long as the
magic *::wrmax isn't changed from its zero default.
apnadkarniplain2023-09-28 16:01:13
That's one possibility. Right now I'm focused on working through the pending bugs. Let's see where things stand after that.
apnadkarniplain2023-09-29 03:35:47
Fixed in [9c204498a8].
jan.nijtmanswiki2023-09-29 08:40:21
apnadkarniplain2023-09-29 12:05:47
Disabled password related tests on MacOS.
apnadkarniplain2023-09-30 16:34:47
This bug is assigned to me, presumably by Jan. However, someone with Mac access and familiarity with that platform will need to pick this up. Tests run without error on Windows and Linux.
serhiy.storchakawiki2026-10-21 10:03:38

Fixed in 9.0.0 by [9c204498a8] (trunk: [bea92dfdc5]): encrypted members can no longer be opened for writing without the password. The macOS-only test failures are tracked in [bbe7c6ff9e].

Log in (anonymous is fine) to add a comment.