Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

A test holds the helper to refusing another spelling of a protected name

Țugui Dragoș56fe4b358500
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AttackHelperPolicyTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AttackHelperPolicyTests.swift
index c6c80669..e42e6d92 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/AttackHelperPolicyTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AttackHelperPolicyTests.swift
@@ -87,6 +87,20 @@ struct AttackHelperPolicyTests {
#expect(!policy.open(path("root/Applications/Real.app", in: directory)).isFailure)
}
+ /// A case insensitive APFS volume reads `ſ` as `s` and `ß` as `ss`, so another spelling of a protected
+ /// folder's last name finds the folder itself. The helper judges the name the disk gives the item it found.
+ @Test func anotherSpellingOfAProtectedNameFindsNoWayIn() throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("home/Library/Messages/chat.db")
+ try directory.file("home/Library/Keychains/login.keychain-db")
+ let library = directory.url.appending(path: "home/Library").path(percentEncoded: false)
+
+ for spelling in ["Meſſages", "Keychainſ", "Keychains/login.keychain-db".replacingOccurrences(of: "s", with: "ſ")] {
+ let result = policy(directory).open(library + "/" + spelling)
+ #expect(result.isFailure, "ATTACK SUCCEEDED: the helper would move \(spelling)")
+ }
+ }
+
/// A symbolic link in a parent folder that leads into iCloud Drive.
@Test func theHelperResolvesASymlinkedParent() throws {
let directory = try TemporaryDirectory()