Skip to content

Commit a484932

Browse files
authored
fix: Default to 0644 when IPA entries have no Unix permissions (#13)
IPAs zipped on Windows store NTFS attributes in the ZIP external file attributes and leave the Unix mode bits (the high 16 bits of external_fa) unset. unzipArchiveAtURL: then derived a permission of 0 from those entries and applied it with setAttributes:, leaving the extracted files with mode 0000. Subsequent reads during signing failed, surfacing to the user as "You don't have permission". Fall back to 0644 when no Unix mode bits are present so these archives extract with readable permissions. Fixes SideStore/SideStore#447
1 parent 7efe511 commit a484932

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

AltSign/Categories/NSFileManager+Zip.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ - (BOOL)unzipArchiveAtURL:(NSURL *)archiveURL toDirectory:(NSURL *)directoryURL
220220
} while (result > 0);
221221

222222
short permissions = (info.external_fa >> 16) & 0x01FF;
223+
if (permissions == 0) {
224+
// No Unix mode bits set -- archive was likely created on Windows.
225+
// Use a readable default so signing can proceed. (Fixes issue #447.)
226+
permissions = 0644;
227+
}
223228
if (![self setAttributes:@{NSFilePosixPermissions: @(permissions)} ofItemAtPath:fileURL.path error:error])
224229
{
225230
finish();

0 commit comments

Comments
 (0)