marmelroy / Zip

Swift framework for zipping and unzipping files.
MIT License
2.51k stars 452 forks source link

Privacy Manifest #258

Open mvn-toantruong-dn opened 8 months ago

mvn-toantruong-dn commented 8 months ago

Hello, I am an employee of Monstarlab company. I have a question about the Privacy Manifest

At WWDC23 Apple announced that apps and SDKs that make use of certain "required reason" APIs etc will need to provide a privacy manifest. Does Zip need to include this manifest? Please let me know about your upcoming plans to apply the privacy manifest.

Here are some useful references:

https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests

https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api

https://developer.apple.com/videos/play/wwdc2023/10060/

Thanks

haniewais commented 8 months ago

It seems that there are some system API calls in this codebase In Zip.swift, the creationDate and modificationDate API's are called.

#if os(Linux)
    // On Linux, setting attributes is not yet really implemented.
    // In Swift 4.2, the only settable attribute is `.posixPermissions`.
    // See https://github.com/apple/swift-corelibs-foundation/blob/swift-4.2-branch/Foundation/FileManager.swift#L182-L196
    directoryAttributes = nil
#else
    directoryAttributes = [.creationDate : creationDate, // ⬅️ ⭐️ System API call 
                           .modificationDate : creationDate] // ⬅️ ⭐️ System API call 
#endif

https://github.com/marmelroy/Zip/blob/bca30f6d6c7d37cbc4aa8f6b0002e281dcc36195/Zip/Zip.swift#L188C1-L197C19


Also here:

do {
    let fileAttributes = try fileManager.attributesOfItem(atPath: filePath)
    if let fileDate = fileAttributes[FileAttributeKey.modificationDate] as? Date {  // ⬅️ ⭐️ System API call 
        let components = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: fileDate)
        zipInfo.tmz_date.tm_sec = UInt32(components.second!)
        zipInfo.tmz_date.tm_min = UInt32(components.minute!)
        zipInfo.tmz_date.tm_hour = UInt32(components.hour!)
        zipInfo.tmz_date.tm_mday = UInt32(components.day!)
        zipInfo.tmz_date.tm_mon = UInt32(components.month!) - 1
        zipInfo.tmz_date.tm_year = UInt32(components.year!)
    }
    if let fileSize = fileAttributes[FileAttributeKey.size] as? Double {
        currentPosition += fileSize
    }
}

https://github.com/marmelroy/Zip/blob/bca30f6d6c7d37cbc4aa8f6b0002e281dcc36195/Zip/Zip.swift#L342C1-L356C18

linhaosunny commented 8 months ago

@marmelroy Any Plan for support Apple Privacy Manifest for cocoapods?