Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Developer reads an archive's Info.plist through the bounded read
Țugui Dragoș369931d20aca
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swiftindex 333a1892..bca14be4 100644--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift@@ -207,8 +207,7 @@ public enum DeveloperCaches {static func archive(at url: URL) -> DeveloperEnvironment.Archive? {guard- let data = try? Data(contentsOf: url.appending(path: "Info.plist")),- let facts = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any],+ let facts = BoundedRead.propertyList(at: url.appending(path: "Info.plist")),let app = facts["ApplicationProperties"] as? [String: Any]else { return nil }let version = app["CFBundleShortVersionString"] as? Stringdiff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swiftindex 20b332b2..6a1d83d4 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift@@ -648,6 +648,21 @@ struct DeveloperCachesTests {#expect(environments.isEmpty)}+ @Test func readsAnArchivesInfoOnlyWhenItIsAPlainFileOfASensibleSize() throws {+ let directory = try TemporaryDirectory()+ let facts: [String: Any] = [+ "ApplicationProperties": ["CFBundleShortVersionString": "2.1", "CFBundleVersion": "45"],+ "Padding": String(repeating: "x", count: BoundedRead.maximumBytes),+ ]+ let data = try PropertyListSerialization.data(fromPropertyList: facts, format: .binary, options: 0)+ try directory.file("Huge.xcarchive/Info.plist", contents: data)+ let pipe = try directory.directory("Pipe.xcarchive").appending(path: "Info.plist")+ #expect(mkfifo(pipe.path(percentEncoded: false), 0o600) == 0)++ #expect(DeveloperCaches.archive(at: directory.url.appending(path: "Huge.xcarchive")) == nil)+ #expect(DeveloperCaches.archive(at: directory.url.appending(path: "Pipe.xcarchive")) == nil)+ }+/// virtualenvwrapper keeps the user's hook scripts beside the environments in `~/.virtualenvs`, so only the/// environments are offered, and a link among them is left where it is, never followed.@Test func offersVirtualenvwrappersEnvironmentsAndNotItsHooks() async throws {