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.

Hold back passwords and wallets in iCloud Drive

Țugui Dragoș91eec8aedf8a
diff --git a/GUIDE.md b/GUIDE.md
index c99c2926..c1957125 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -144,9 +144,10 @@ Space shows what fills your disk, area by area, and what each area is.
shows them in, named as Finder names them, the biggest first, and a folder's checkbox selects every file in it that
Peel recommends; a file that would free less than 1 MB isn't listed. Remove Downloads, as in Finder, takes away only
the copy on this Mac: each file stays in iCloud and downloads again when you open it. A file Keep Downloaded is on
- for in Finder is listed and not selected, since iCloud would download it again at once. A download whose space on
- disk is shared with another copy on this Mac would free nothing, so it isn't listed, and the page says how many
- there are. The page needs Full Disk Access to see what is kept on this Mac.
+ for in Finder is listed and not selected, since iCloud would download it again at once, and so is a password
+ database or a wallet's keys, which would open again only with an internet connection. A download whose space on disk
+ is shared with another copy on this Mac would free nothing, so it isn't listed, and the page says how many there
+ are. The page needs Full Disk Access to see what is kept on this Mac.
- **Space:** what fills your disk, area by area, and which app or tool each area belongs to.
- **File Search:** files by name, kind, or size, and by age along with one of them, in your home folder or across this
Mac's disks, not network volumes, found through Spotlight, up to 2,000 at a time, so a folder in System Settings >
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 294295f5..a90216a0 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -102671,6 +102671,113 @@
}
}
},
+ "Not selected: it holds passwords or a wallet’s keys, which open again only with an internet connection once the download is removed." : {
+ "comment" : "The note beside a file in iCloud Drive that is a password database, such as a KeePass file, or holds a crypto wallet's keys. Once this Mac's copy is removed, the file stays in iCloud and downloads only when opened online.",
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nevybráno: obsahuje hesla nebo klíče peněženky a po odstranění stažené kopie půjde znovu otevřít jen s připojením k internetu."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nicht ausgewählt: Diese Datei enthält Passwörter oder die Schlüssel einer Wallet, die sich nach dem Entfernen des Downloads nur mit einer Internetverbindung wieder öffnen lassen."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sin seleccionar: contiene contraseñas o las claves de un monedero digital, que, una vez eliminada la descarga, solo se pueden volver a abrir con conexión a internet."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non sélectionné : ce fichier contient des mots de passe ou les clés d’un portefeuille, auxquels vous n’aurez de nouveau accès qu’avec une connexion à Internet une fois le téléchargement retiré."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non selezionato: contiene password o le chiavi di un wallet, che, una volta rimosso il download, saranno di nuovo accessibili solo con una connessione a internet."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未選択: パスワードまたはウォレットの鍵が含まれているため、ダウンロードしたものを削除すると、再び開くにはインターネット接続が必要になります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택되지 않음: 암호나 지갑의 키가 들어 있으며, 다운로드를 제거하면 인터넷에 연결되어 있을 때만 다시 열 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Niet geselecteerd: het bevat wachtwoorden of de sleutels van een wallet, die je na het verwijderen van de download alleen met een internetverbinding weer kunt openen."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie zaznaczono: ten plik zawiera hasła lub klucze portfela, a po usunięciu jego pobranej kopii ich ponowne otwarcie będzie wymagać połączenia z Internetem."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Não selecionado: ele contém senhas ou as chaves de uma carteira e, depois que o download for removido, só voltará a abrir com uma conexão à internet."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Neselectat: acest fișier conține parole sau cheile unui portofel, care, după eliminarea descărcării, pot fi deschise din nou doar cu o conexiune la internet."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Не выбрано: этот файл содержит пароли или ключи кошелька, которые после удаления загруженной копии снова станут доступны только при подключении к интернету."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Inte markerad: den innehåller lösenord eller en plånboks nycklar, som bara går att öppna igen med en internetanslutning när hämtningen har tagits bort."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Seçilmedi: içinde parolalar veya bir cüzdanın anahtarları var; indirilen kopyası kaldırıldığında bunlar ancak internet bağlantısıyla yeniden açılabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Не вибрано: цей файл містить паролі або ключі гаманця, і після вилучення викачування відкрити його знову можна буде лише за наявності інтернет-зʼєднання."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未选择:它包含密码或钱包的密钥,移除下载后,只有连接到互联网时才能再次打开。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未選取:它存有密碼或錢包的密鑰,移除下載項目後,只有在連上網際網路時才能再次打開。"
+ }
+ }
+ }
+ },
"Not selected: it holds your current workspace and the last backend configuration, which `terraform init` doesn’t bring back." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
index f82f8028..81c63f20 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
@@ -396,6 +396,7 @@ extension HoldBack {
case .keepsWhatTheOthersLack: "has Finder tags, a comment, or a resource fork the other copies don't"
case .keptDownloaded: "Keep Downloaded is on for it in Finder, so iCloud downloads it again"
case .inAnAppsICloudFolder: "in an app's own iCloud folder, which the app may expect to find on this Mac"
+ case .opensOnlyOnline: "holds passwords or a wallet's keys, which would open again only online"
case .openInAProgram: "open in a program right now, which may still be using it"
case .attachedDiskImage: "a disk image open right now; eject it first"
case .changedRecently: "changed in the last day, so it may still be downloading"
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
index 4101a7cb..41b8e1ab 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
@@ -168,6 +168,9 @@ public enum HoldBack: String, Sendable, Hashable {
/// A download in an app's own folder in iCloud, which Finder may not show and the app may expect to find on
/// this Mac.
case inAnAppsICloudFolder
+ /// A password database or a wallet's keys in iCloud, which opens again only with an internet connection once its
+ /// download is removed.
+ case opensOnlyOnline
/// True when the item cannot be selected at all, rather than only left unselected: the guard or the helper
/// would refuse to move it.
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
index 26d89af2..84e0bc18 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
@@ -339,12 +339,20 @@ public enum CloudStorage {
modified: measured.modified,
isDesktopPicture: pictures.contains(PathPattern.comparablePath(of: url)),
heldBack: isInAPinnedFolder || isPinned(url) ? .keptDownloaded
+ : holdsSecrets(url, below: root) ? .opensOnlyOnline
: isICloudDrive ? nil : .inAnAppsICloudFolder
)
collector.add(file)
}
}
+ /// Whether `url`, or a folder it sits in below `root`, is named as a password database or a wallet's keys are.
+ static func holdsSecrets(_ url: URL, below root: URL) -> Bool {
+ let names = PathComponents.of(url.path(percentEncoded: false))
+ .dropFirst(PathComponents.of(root.path(percentEncoded: false)).count)
+ return names.contains { FileSize.isPasswordDatabase($0) || FileSize.isWallet($0) }
+ }
+
/// Whether Keep Downloaded is on for `url` in Finder: FileProvider keeps it as the extended attribute
/// `com.apple.fileprovider.pinned`, whose stored name carries flags after a `#` (`xattr_name_with_flags(3)`).
static func isPinned(_ url: URL) -> Bool {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
index 2c758d5e..6e3b07a3 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
@@ -239,6 +239,28 @@ struct CloudStorageTests {
#expect(held["notes.db"] == .inAnAppsICloudFolder)
}
+ /// A password database or a wallet's keys, once its download is removed, opens again only with an internet
+ /// connection: it is listed and not recommended, and so is every file in a wallet's folder.
+ @Test func holdsBackPasswordsAndWalletsItWouldTakeOffline() throws {
+ let directory = try TemporaryDirectory()
+ let drive = "Library/Mobile Documents/com~apple~CloudDocs"
+ for path in ["Passwords.kdbx", "Coins/wallets/wallet.dat", "Coins/wallets/db.log", "Coins/prices.csv"] {
+ try directory.file("\(drive)/\(path)", bytes: 2_000)
+ }
+
+ let collector = CloudStorage.Collector()
+ CloudStorage.collect(
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ countingFor: nil, isSafe: { _ in true }, isPinned: { _ in false }, unless: { false }
+ )
+
+ let held = Dictionary(uniqueKeysWithValues: collector.collected.files.map { ($0.name, $0.heldBack) })
+ #expect(held["Passwords.kdbx"] == .opensOnlyOnline)
+ #expect(held["wallet.dat"] == .opensOnlyOnline)
+ #expect(held["db.log"] == .opensOnlyOnline)
+ #expect(held["prices.csv"] == .some(nil))
+ }
+
/// A folder kept only in the cloud, which no test can make, is named to the walk.
@Test func neverLooksIntoAFolderThatLivesOnlyInTheCloud() throws {
let directory = try TemporaryDirectory()
diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swift
index 64c23ade..90c98963 100644
--- a/Peel/Views/Presentation.swift
+++ b/Peel/Views/Presentation.swift
@@ -412,6 +412,8 @@ extension HoldBack {
"Not selected: Keep Downloaded is on for it in Finder, so iCloud downloads it again."
case .inAnAppsICloudFolder:
"Not selected: it is in an app’s own iCloud folder, which Finder may not show, and the app may expect to find it on this Mac."
+ case .opensOnlyOnline:
+ "Not selected: it holds passwords or a wallet’s keys, which open again only with an internet connection once the download is removed."
case .openInAProgram:
"Not selected: a program has this open right now, and may still be using it."
case .attachedDiskImage:
diff --git a/SAFETY.md b/SAFETY.md
index 0133dbf1..3a0c8d57 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -418,6 +418,9 @@ Never selected for you, even when found:
last hour, which you may be installing from.
- A build folder Git tracks files in, and a folder an installer package made that now holds what something else put
there, which may be another program's files or yours.
+- In iCloud Drive, the download of a file Keep Downloaded is on for, which iCloud would download again at once, of a
+ password database or a wallet's keys, which would open again only with an internet connection, and of what an app
+ keeps in its own iCloud folder, which the app may expect to find on this Mac.
A folder macOS would not let Peel read, and a folder Peel could not measure in time, are not selected either. Both are
shown with their size as "Unknown", never as zero, in every tool and in History once they are moved: a folder too big to