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
Let an account that isn't an administrator use the helper with an administrator's approval
Țugui Dragoșbd24d53e8bb6
diff --git a/AGENTS.md b/AGENTS.mdindex 7d410cdd..e06a8c40 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -158,9 +158,11 @@ checked by hand. If a change makes one of them fail, the rule is right and the cdisk that somebody may have replaced.- It has no shell, accepts no path outside the folders it serves, and refuses whenever it is unsure.-- It answers administrators only, asked when a connection opens and again with each message. The account is the- connection's and says nothing about which process sent a message (`xpc_connection_create(3)`), so no rule may rest- on it for that.+- It answers an administrator, and another account only for a request carrying an administrator's approval in force+ (`AdministratorAuthorization`), asked again with each message. The account is the connection's and says nothing+ about which process sent a message (`xpc_connection_create(3)`), so no rule may rest on it for that.+- The approval is for Apple's `system.privilege.admin`, never a right of Peel's own: macOS lets any process add a right+ that doesn't exist yet (`config.add.`), so another process of the account could define one as granted first.- It accepts only a copy of Peel signed by the same team and no older a build than itself, checked when a connectionopens and for every message after it, and a released helper refuses a build that can be debugged.- **Only an administrator changes it.** macOS lets any account unregister a system daemon without asking, so everydiff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 9d819100..f5048c85 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -24,7 +24,7 @@ flowchart LRCLI["peel command<br>runs as you"] --> Commands["PeelCommandLine<br>the peel commands"]Commands --> Core["PeelCore<br>scans, matches, moves"]App --> Core- App -- "XPC, administrators only" --> Helper["Helper<br>runs as root"]+ App -- "XPC, an administrator or their approval" --> Helper["Helper<br>runs as root"]Core --> Privileged["PeelPrivileged<br>what may be touched"]Helper --> Privileged```@@ -255,9 +255,10 @@ macOS asks the user to approve it once. It talks to the app over XPC.- Only an administrator installs, repairs, or uninstalls it. macOS lets any account unregister a daemon, so the appasks again at that moment whether this account is an administrator (`PrivilegedHelper.changeAsAnAdministrator`),and Remove Peel, from an account that isn't, leaves the helper and Peel where they are.-- It answers administrators only, asked when a connection opens and again with each message, and it accepts- only a copy of Peel signed by the same team and no older a build than itself, checked when a connection opens- and for every message after it.+- It answers an administrator, and another account only with an administrator's approval for each action, which+ Peel asks for once per action in macOS's own window (`AdministratorConsent`, for `system.privilege.admin`), asked+ again with each message, and it accepts only a copy of Peel signed by the same team and no older a build than+ itself, checked when a connection opens and for every message after it.A released helper refuses a build that can be debugged, and launchd starts the helper only as the team's ownbuild of it (`SpawnConstraint` in its launchd property list).- Its calls are declared by `PeelHelperProtocol`, indiff --git a/GUIDE.md b/GUIDE.mdindex a8b36504..ff6101bc 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -466,9 +466,10 @@ and takes you straight to the right place in System Settings, or, for the comman| Command Line (optional) | Use `peel` from anywhere in Terminal. Home's Copy button, like Settings > General, copies the command that puts it on your path, and Terminal asks for your password when you run it. |Install the helper from Home, or with Install Helper in Settings > Helper, from an administrator's account, then allow-it in System Settings > General > Login Items & Extensions. If Home says the helper isn't answering, choose Repair-there, or Repair Helper in Settings > Helper. If it keeps waiting for approval, the questions in-[README.md](README.md#frequently-asked-questions) say what to do.+it in System Settings > General > Login Items & Extensions. Once it works, an account that isn't an administrator uses+it too: macOS asks for an administrator's name and password once for each action that needs it. If Home says the+helper isn't answering, choose Repair there, or Repair Helper in Settings > Helper. If it keeps waiting for approval,+the questions in [README.md](README.md#frequently-asked-questions) say what to do.## Languagesdiff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 7adcf688..cc08765a 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -17890,6 +17890,112 @@}}},+ "An administrator didn’t allow this." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Správce to nepovolil."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ein Administrator hat dies nicht erlaubt."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ningún administrador lo ha permitido."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aucun administrateur n’a autorisé cette opération."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nessun amministratore ha consentito questa operazione."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "管理者がこの操作を許可しませんでした。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "관리자가 허용하지 않았습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Een beheerder heeft dit niet toegestaan."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Administrator na to nie pozwolił."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nenhum administrador permitiu isto."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Un administrator nu a permis acest lucru."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Администратор не разрешил это действие."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "En administratör tillät inte det här."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bir yönetici buna izin vermedi."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Адміністратор цього не дозволив."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "管理员未允许此操作。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "管理者未允許此動作。"+ }+ }+ }+ },"An app from the same maker is still installed" : {"localizations" : {"cs" : {@@ -124476,533 +124582,532 @@}}},- "Only an administrator can move these" : {+ "Only an administrator can install, allow, or repair Peel’s helper. Once it works, Peel asks for an administrator’s name and password for this." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Tyto položky může přesunout jen správce"+ "value" : "Pomocníka Peelu může nainstalovat, povolit nebo opravit jen správce. Jakmile bude pomocník fungovat, Peel si pro tuto akci vyžádá jméno a heslo správce."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Nur ein Administrator kann diese verschieben"+ "value" : "Nur ein Administrator kann das Hilfsprogramm von Peel installieren, erlauben oder reparieren. Sobald es funktioniert, fragt Peel dafür nach Namen und Passwort eines Administrators."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un administrador puede trasladar estos ítems"+ "value" : "Solo un administrador puede instalar, permitir o reparar el asistente de Peel. Cuando funcione, Peel pedirá el nombre y la contraseña de un administrador para esto."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Seul un administrateur peut déplacer ces éléments"+ "value" : "Seul un administrateur peut installer, autoriser ou réparer l’utilitaire de Peel. Une fois qu’il fonctionne, Peel demande le nom et le mot de passe d’un administrateur pour cette opération."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un amministratore può spostarli"+ "value" : "Solo un amministratore può installare, autorizzare o riparare l’assistente di Peel. Quando funziona, Peel chiede il nome e la password di un amministratore per questa operazione."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "これらを移動できるのは管理者だけです"+ "value" : "Peelのヘルパーのインストール、許可、修復ができるのは管理者だけです。ヘルパーが動作するようになれば、この操作の際に、Peelが管理者の名前とパスワードを求めます。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "관리자만 이 항목들을 이동할 수 있음"+ "value" : "관리자만 Peel 보조 프로그램을 설치, 허용 또는 복구할 수 있습니다. 보조 프로그램이 작동하면, 이 작업을 할 때 Peel이 관리자 이름 및 암호를 요청합니다."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Alleen een beheerder kan deze verplaatsen"+ "value" : "Alleen een beheerder kan het hulpprogramma van Peel installeren, toestaan of herstellen. Zodra het werkt, vraagt Peel hiervoor om de naam en het wachtwoord van een beheerder."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Przenieść je może tylko administrator"+ "value" : "Tylko administrator może zainstalować pomocnika Peel, pozwolić na jego działanie lub go naprawić. Gdy pomocnik będzie działać, Peel będzie prosić o nazwę i hasło administratora, aby to zrobić."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "Só um administrador pode mover estes itens"+ "value" : "Só um administrador pode instalar, permitir ou reparar o auxiliar do Peel. Quando ele estiver funcionando, o Peel pede o nome e a senha de um administrador para isso."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Doar un administrator le poate muta"+ "value" : "Doar un administrator poate instala, permite sau repara instrumentul de ajutor Peel. După ce acesta funcționează, Peel cere numele și parola unui administrator pentru acest lucru."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Переместить эти объекты может только администратор"+ "value" : "Установить, разрешить или исправить помощника Peel может только администратор. Когда помощник заработает, Peel будет запрашивать для этого имя и пароль администратора."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Bara en administratör kan flytta de här"+ "value" : "Bara en administratör kan installera, tillåta eller reparera Peels hjälpprogram. När det fungerar ber Peel om en administratörs namn och lösenord för det här."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Bunları yalnızca bir yönetici taşıyabilir"+ "value" : "Peel’in yardımcısını yalnızca bir yönetici yükleyebilir, ona izin verebilir veya onu onarabilir. Yardımcı çalışır duruma geldiğinde Peel, bunun için bir yönetici adı ve parolası ister."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Перемістити їх може лише адміністратор"+ "value" : "Інсталювати, дозволити або полагодити помічника Peel може лише адміністратор. Щойно помічник запрацює, Peel запитуватиме для цього імʼя та пароль адміністратора."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理员才能移动这些项目"+ "value" : "只有管理员才能安装、允许或修复Peel的帮助程序。帮助程序正常工作后,Peel会为此要求输入管理员名称和密码。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理者能移動這些項目"+ "value" : "只有管理者能安裝、允許或修復Peel的輔助程式。輔助程式可以運作後,Peel就會為此要求輸入管理者的名稱和密碼。"}}}},- "Only an administrator can move these, and Peel’s helper isn’t allowed to move them from where they are. To remove one, show it in Finder, drag it to the Trash, then enter an administrator name and password when macOS asks." : {+ "Only an administrator can install, allow, or repair the helper. Once it works, Peel asks for an administrator’s name and password each time this account needs it." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Tyto položky může přesunout jen správce a pomocník Peelu je nesmí přesunout z místa, kde jsou. Chcete-li některou z nich odstranit, zobrazte ji ve Finderu, přetáhněte ji do koše a potom zadejte jméno a heslo správce, až o ně macOS požádá."+ "value" : "Pomocníka může nainstalovat, povolit nebo opravit jen správce. Jakmile bude pomocník fungovat, Peel si pokaždé, když ho bude tento účet potřebovat, vyžádá jméno a heslo správce."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Nur ein Administrator kann diese verschieben, und das Hilfsprogramm von Peel darf sie von dort, wo sie sind, nicht verschieben. Um eines davon zu entfernen, zeige es im Finder an, ziehe es in den Papierkorb und gib dann den Adminnamen und das Adminpasswort ein, wenn macOS danach fragt."+ "value" : "Nur ein Administrator kann das Hilfsprogramm installieren, erlauben oder reparieren. Sobald es funktioniert, fragt Peel jedes Mal nach Namen und Passwort eines Administrators, wenn dieser Benutzeraccount es benötigt."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un administrador puede trasladar estos ítems, y el asistente de Peel no tiene permiso para trasladarlos desde donde están. Para eliminar uno, muéstralo en el Finder, arrástralo a la papelera y, después, introduce un nombre de administrador y la contraseña cuando macOS te lo pida."+ "value" : "Solo un administrador puede instalar, permitir o reparar el asistente. Cuando funcione, Peel pedirá el nombre y la contraseña de un administrador cada vez que esta cuenta lo necesite."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Seul un administrateur peut déplacer ces éléments, et l’utilitaire de Peel n’est pas autorisé à les déplacer depuis leur emplacement. Pour en supprimer un, affichez-le dans le Finder, faites-le glisser dans la corbeille, puis saisissez un nom et un mot de passe d’administrateur lorsque macOS vous le demande."+ "value" : "Seul un administrateur peut installer, autoriser ou réparer l’utilitaire. Une fois qu’il fonctionne, Peel demande le nom et le mot de passe d’un administrateur chaque fois que ce compte en a besoin."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un amministratore può spostare questi elementi, e all’assistente di Peel non è consentito spostarli da dove si trovano. Per rimuoverne uno, mostralo nel Finder, trascinalo nel Cestino, poi inserisci un nome e una password di amministratore quando macOS te lo chiede."+ "value" : "Solo un amministratore può installare, autorizzare o riparare l’assistente. Quando funziona, Peel chiede il nome e la password di un amministratore ogni volta che questo account ne ha bisogno."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "これらを移動できるのは管理者だけで、Peelのヘルパーはこれらがある場所からの移動を許可されていません。項目を取り除くには、Finderに表示してゴミ箱にドラッグし、macOSから求められたら管理者名とパスワードを入力してください。"+ "value" : "ヘルパーのインストール、許可、修復ができるのは管理者だけです。ヘルパーが動作するようになれば、このアカウントでヘルパーが必要になるたびに、Peelが管理者の名前とパスワードを求めます。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "관리자만 이 항목들을 이동할 수 있으며, Peel 보조 프로그램이 현재 위치에서 이 항목들을 이동하는 것은 허용되지 않습니다. 항목을 제거하려면 Finder에서 해당 항목을 보고 휴지통으로 드래그한 다음, macOS가 요청하면 관리자 이름 및 암호를 입력하십시오."+ "value" : "관리자만 보조 프로그램을 설치, 허용 또는 복구할 수 있습니다. 보조 프로그램이 작동하면, 이 계정에서 보조 프로그램이 필요할 때마다 Peel이 관리자 이름 및 암호를 요청합니다."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Alleen een beheerder kan deze verplaatsen, en het hulpprogramma van Peel mag ze daar niet vandaan verplaatsen. Om een onderdeel te verwijderen, toon je het in Finder, sleep je het naar de prullenmand en voer je daarna de naam en het wachtwoord van een beheerder in als macOS erom vraagt."+ "value" : "Alleen een beheerder kan het hulpprogramma installeren, toestaan of herstellen. Zodra het werkt, vraagt Peel om de naam en het wachtwoord van een beheerder telkens wanneer deze account het nodig heeft."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Przenieść te rzeczy może tylko administrator, a pomocnikowi Peel nie wolno ich przenosić z miejsc, w których się znajdują. Aby pozbyć się jednej z nich, pokaż ją w Finderze, przeciągnij do Kosza, a następnie wprowadź nazwę i hasło administratora, gdy macOS o to poprosi."+ "value" : "Tylko administrator może zainstalować pomocnika, pozwolić na jego działanie lub go naprawić. Gdy pomocnik będzie działać, Peel będzie prosić o nazwę i hasło administratora za każdym razem, gdy to konto będzie go potrzebować."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "Só um administrador pode mover estes itens, e o auxiliar do Peel não tem permissão para movê-los de onde estão. Para remover um deles, mostre-o no Finder, arraste-o para o Lixo, depois insira o nome e a senha de um administrador quando o macOS pedir."+ "value" : "Só um administrador pode instalar, permitir ou reparar o auxiliar. Quando ele estiver funcionando, o Peel pede o nome e a senha de um administrador sempre que esta conta precisar dele."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Doar un administrator poate muta aceste articole, iar instrumentul de ajutor Peel nu are voie să le mute de unde se află. Pentru a elimina unul, afișați‑l în Finder, trageți‑l în Coș, apoi introduceți un nume de administrator și o parolă când macOS vi le cere."+ "value" : "Doar un administrator poate instala, permite sau repara instrumentul de ajutor. După ce acesta funcționează, Peel cere numele și parola unui administrator de fiecare dată când acest cont are nevoie de el."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Переместить эти объекты может только администратор, а помощнику Peel не разрешено перемещать их оттуда, где они находятся. Чтобы удалить объект, покажите его в Finder, перетяните в Корзину, затем введите имя и пароль администратора, когда macOS их запросит."+ "value" : "Установить, разрешить или исправить помощника может только администратор. Когда помощник заработает, Peel будет запрашивать имя и пароль администратора каждый раз, когда он понадобится этой учетной записи."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Bara en administratör kan flytta de här, och Peels hjälpprogram får inte flytta dem från deras nuvarande plats. Om du vill ta bort ett av dem visar du det i Finder, drar det till papperskorgen och anger sedan ett administratörsnamn och lösenord när macOS ber om det."+ "value" : "Bara en administratör kan installera, tillåta eller reparera hjälpprogrammet. När det fungerar ber Peel om en administratörs namn och lösenord varje gång det här kontot behöver det."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Bunları yalnızca bir yönetici taşıyabilir ve Peel’in yardımcısının onları bulundukları yerden taşımasına izin verilmiyor. Bunlardan birini kaldırmak için onu Finder’da gösterin, Çöp Sepeti’ne sürükleyin, ardından macOS istediğinde bir yönetici adı ve parolası girin."+ "value" : "Yardımcıyı yalnızca bir yönetici yükleyebilir, ona izin verebilir veya onu onarabilir. Yardımcı çalışır duruma geldiğinde Peel, bu hesap ona her ihtiyaç duyduğunda bir yönetici adı ve parolası ister."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Перемістити їх може лише адміністратор, а помічнику Peel не дозволено переміщувати їх звідти, де вони лежать. Щоб вилучити один із них, покажіть його у Finder, перетягніть його в Смітник, а потім введіть імʼя й пароль адміністратора, коли macOS запитає."+ "value" : "Інсталювати, дозволити або полагодити помічника може лише адміністратор. Щойно помічник запрацює, Peel щоразу запитуватиме імʼя та пароль адміністратора, коли він знадобиться цьому обліковому запису."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理员才能移动这些项目,而Peel的帮助程序不能从其所在的位置移动它们。若要移除其中一项,请在“访达”中显示它,将它拖到废纸篓,然后在macOS要求时输入管理员名称和密码。"+ "value" : "只有管理员才能安装、允许或修复帮助程序。帮助程序正常工作后,此账户每次需要它时,Peel都会要求输入管理员名称和密码。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理者能移動這些項目,而Peel的輔助程式不能從所在位置移動它們。若要移除其中一個項目,請將它顯示於Finder並拖到「垃圾桶」,然後在macOS要求時輸入管理者名稱和密碼。"+ "value" : "只有管理者能安裝、允許或修復輔助程式。輔助程式可以運作後,每當此帳號需要它時,Peel都會要求輸入管理者的名稱和密碼。"}}}},- "Only an administrator can remove Peel’s helper, so Peel can’t remove itself from this account. Log in as an administrator and choose Remove Peel there." : {+ "Only an administrator can move these" : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Pomocníka Peelu může odstranit jen správce, takže Peel se z tohoto účtu odstranit nemůže. Přihlaste se jako správce a tam zvolte „Odstranit Peel“."+ "value" : "Tyto položky může přesunout jen správce"}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Nur ein Administrator kann das Hilfsprogramm von Peel entfernen, daher kann sich Peel mit diesem Benutzeraccount nicht selbst entfernen. Melde dich als Administrator an und wähle dort „Peel entfernen“."+ "value" : "Nur ein Administrator kann diese verschieben"}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un administrador puede eliminar el asistente de Peel, así que Peel no puede eliminarse desde esta cuenta. Inicia sesión como administrador y elige “Eliminar Peel” allí."+ "value" : "Solo un administrador puede trasladar estos ítems"}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Seul un administrateur peut supprimer l’utilitaire de Peel : Peel ne peut donc pas se supprimer depuis ce compte. Ouvrez une session en tant qu’administrateur et choisissez « Supprimer Peel » dans cette session."+ "value" : "Seul un administrateur peut déplacer ces éléments"}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un amministratore può rimuovere l’assistente di Peel, quindi Peel non può rimuovere sé stesso da questo account. Esegui il login come amministratore e scegli “Rimuovi Peel” da lì."+ "value" : "Solo un amministratore può spostarli"}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "Peelのヘルパーを取り除けるのは管理者だけのため、Peelはこのアカウントから自身をアンインストールできません。管理者としてログインし、そこで“Peelをアンインストール”を選択してください。"+ "value" : "これらを移動できるのは管理者だけです"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "관리자만 Peel 보조 프로그램을 제거할 수 있으므로, 이 계정에서는 Peel이 자신을 제거할 수 없습니다. 관리자로 로그인한 다음 그곳에서 ‘Peel 제거’를 선택하십시오."+ "value" : "관리자만 이 항목들을 이동할 수 있음"}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Alleen een beheerder kan het hulpprogramma van Peel verwijderen, dus Peel kan zichzelf niet verwijderen vanuit deze account. Log in als beheerder en kies daar 'Verwijder Peel'."+ "value" : "Alleen een beheerder kan deze verplaatsen"}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Tylko administrator może odinstalować pomocnika Peel, więc Peel nie może odinstalować się z tego konta. Zaloguj się jako administrator i tam wybierz „Odinstaluj Peel”."+ "value" : "Przenieść je może tylko administrator"}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "Só um administrador pode remover o auxiliar do Peel, então o Peel não pode se remover a partir desta conta. Inicie sessão como administrador e escolha “Remover o Peel” lá."+ "value" : "Só um administrador pode mover estes itens"}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Doar un administrator poate elimina instrumentul de ajutor Peel, așa că Peel nu se poate elimina din acest cont. Faceți login ca administrator și alegeți „Eliminați Peel” de acolo."+ "value" : "Doar un administrator le poate muta"}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Удалить помощника Peel может только администратор, поэтому из этой учетной записи Peel не может удалить себя. Войдите как администратор и выберите там «Удалить Peel»."+ "value" : "Переместить эти объекты может только администратор"}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Bara en administratör kan ta bort Peels hjälpprogram, så Peel kan inte ta bort sig själv från det här kontot. Logga in som administratör och välj ”Ta bort Peel” där."+ "value" : "Bara en administratör kan flytta de här"}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Peel’in yardımcısını yalnızca bir yönetici kaldırabilir, bu yüzden Peel kendini bu hesaptan kaldıramaz. Yönetici olarak oturum açın ve orada “Peel’i Kaldır” düğmesini tıklayın."+ "value" : "Bunları yalnızca bir yönetici taşıyabilir"}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Вилучити помічника Peel може лише адміністратор, тож із цього облікового запису Peel не може вилучити себе. Увійдіть як адміністратор і виберіть там «Вилучити Peel»."+ "value" : "Перемістити їх може лише адміністратор"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理员才能移除Peel的帮助程序,因此Peel无法在此账户中移除自己。请以管理员身份登录,然后在那里选取“移除Peel”。"+ "value" : "只有管理员才能移动这些项目"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理者能移除Peel的輔助程式,因此Peel無法從此帳號移除自己。請以管理者身分登入,並在那裡選擇「移除Peel」。"+ "value" : "只有管理者能移動這些項目"}}}},- "Only an administrator can use Peel’s helper, so Peel can’t do this from this account." : {- "comment" : "Under a banner whose title says what needs the helper, for an account that isn’t an administrator. “This” is that action.",+ "Only an administrator can move these, and Peel’s helper isn’t allowed to move them from where they are. To remove one, show it in Finder, drag it to the Trash, then enter an administrator name and password when macOS asks." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Pomocníka Peelu může používat jen správce, takže Peel to z tohoto účtu udělat nemůže."+ "value" : "Tyto položky může přesunout jen správce a pomocník Peelu je nesmí přesunout z místa, kde jsou. Chcete-li některou z nich odstranit, zobrazte ji ve Finderu, přetáhněte ji do koše a potom zadejte jméno a heslo správce, až o ně macOS požádá."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Nur ein Administrator kann das Hilfsprogramm von Peel verwenden, daher kann Peel dies nicht mit diesem Benutzeraccount tun."+ "value" : "Nur ein Administrator kann diese verschieben, und das Hilfsprogramm von Peel darf sie von dort, wo sie sind, nicht verschieben. Um eines davon zu entfernen, zeige es im Finder an, ziehe es in den Papierkorb und gib dann den Adminnamen und das Adminpasswort ein, wenn macOS danach fragt."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un administrador puede usar el asistente de Peel, así que Peel no puede hacer esto desde esta cuenta."+ "value" : "Solo un administrador puede trasladar estos ítems, y el asistente de Peel no tiene permiso para trasladarlos desde donde están. Para eliminar uno, muéstralo en el Finder, arrástralo a la papelera y, después, introduce un nombre de administrador y la contraseña cuando macOS te lo pida."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Seul un administrateur peut utiliser l’utilitaire de Peel : Peel ne peut donc pas effectuer cette opération depuis ce compte."+ "value" : "Seul un administrateur peut déplacer ces éléments, et l’utilitaire de Peel n’est pas autorisé à les déplacer depuis leur emplacement. Pour en supprimer un, affichez-le dans le Finder, faites-le glisser dans la corbeille, puis saisissez un nom et un mot de passe d’administrateur lorsque macOS vous le demande."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un amministratore può usare l’assistente di Peel, quindi Peel non può eseguire questa operazione da questo account."+ "value" : "Solo un amministratore può spostare questi elementi, e all’assistente di Peel non è consentito spostarli da dove si trovano. Per rimuoverne uno, mostralo nel Finder, trascinalo nel Cestino, poi inserisci un nome e una password di amministratore quando macOS te lo chiede."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "Peelのヘルパーを使用できるのは管理者だけのため、Peelはこのアカウントからこの操作を行えません。"+ "value" : "これらを移動できるのは管理者だけで、Peelのヘルパーはこれらがある場所からの移動を許可されていません。項目を取り除くには、Finderに表示してゴミ箱にドラッグし、macOSから求められたら管理者名とパスワードを入力してください。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "관리자만 Peel 보조 프로그램을 사용할 수 있으므로, 이 계정에서는 Peel이 이 동작을 수행할 수 없습니다."+ "value" : "관리자만 이 항목들을 이동할 수 있으며, Peel 보조 프로그램이 현재 위치에서 이 항목들을 이동하는 것은 허용되지 않습니다. 항목을 제거하려면 Finder에서 해당 항목을 보고 휴지통으로 드래그한 다음, macOS가 요청하면 관리자 이름 및 암호를 입력하십시오."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Alleen een beheerder kan het hulpprogramma van Peel gebruiken, dus Peel kan dit niet doen vanuit deze account."+ "value" : "Alleen een beheerder kan deze verplaatsen, en het hulpprogramma van Peel mag ze daar niet vandaan verplaatsen. Om een onderdeel te verwijderen, toon je het in Finder, sleep je het naar de prullenmand en voer je daarna de naam en het wachtwoord van een beheerder in als macOS erom vraagt."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Z pomocnika Peel może korzystać tylko administrator, więc z tego konta Peel nie może tego zrobić."+ "value" : "Przenieść te rzeczy może tylko administrator, a pomocnikowi Peel nie wolno ich przenosić z miejsc, w których się znajdują. Aby pozbyć się jednej z nich, pokaż ją w Finderze, przeciągnij do Kosza, a następnie wprowadź nazwę i hasło administratora, gdy macOS o to poprosi."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "Só um administrador pode usar o auxiliar do Peel, então o Peel não pode fazer isso a partir desta conta."+ "value" : "Só um administrador pode mover estes itens, e o auxiliar do Peel não tem permissão para movê-los de onde estão. Para remover um deles, mostre-o no Finder, arraste-o para o Lixo, depois insira o nome e a senha de um administrador quando o macOS pedir."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Doar un administrator poate folosi instrumentul de ajutor Peel, așa că Peel nu poate face acest lucru din acest cont."+ "value" : "Doar un administrator poate muta aceste articole, iar instrumentul de ajutor Peel nu are voie să le mute de unde se află. Pentru a elimina unul, afișați‑l în Finder, trageți‑l în Coș, apoi introduceți un nume de administrator și o parolă când macOS vi le cere."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Помощником Peel может пользоваться только администратор, поэтому из этой учетной записи Peel не может это сделать."+ "value" : "Переместить эти объекты может только администратор, а помощнику Peel не разрешено перемещать их оттуда, где они находятся. Чтобы удалить объект, покажите его в Finder, перетяните в Корзину, затем введите имя и пароль администратора, когда macOS их запросит."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Bara en administratör kan använda Peels hjälpprogram, så Peel kan inte göra det här från det här kontot."+ "value" : "Bara en administratör kan flytta de här, och Peels hjälpprogram får inte flytta dem från deras nuvarande plats. Om du vill ta bort ett av dem visar du det i Finder, drar det till papperskorgen och anger sedan ett administratörsnamn och lösenord när macOS ber om det."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Peel’in yardımcısını yalnızca bir yönetici kullanabilir, bu yüzden Peel bu işlemi bu hesaptan yapamaz."+ "value" : "Bunları yalnızca bir yönetici taşıyabilir ve Peel’in yardımcısının onları bulundukları yerden taşımasına izin verilmiyor. Bunlardan birini kaldırmak için onu Finder’da gösterin, Çöp Sepeti’ne sürükleyin, ardından macOS istediğinde bir yönetici adı ve parolası girin."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Користуватися помічником Peel може лише адміністратор, тож із цього облікового запису Peel не може цього зробити."+ "value" : "Перемістити їх може лише адміністратор, а помічнику Peel не дозволено переміщувати їх звідти, де вони лежать. Щоб вилучити один із них, покажіть його у Finder, перетягніть його в Смітник, а потім введіть імʼя й пароль адміністратора, коли macOS запитає."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理员才能使用Peel的帮助程序,因此Peel无法在此账户中执行此操作。"+ "value" : "只有管理员才能移动这些项目,而Peel的帮助程序不能从其所在的位置移动它们。若要移除其中一项,请在“访达”中显示它,将它拖到废纸篓,然后在macOS要求时输入管理员名称和密码。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理者能使用Peel的輔助程式,因此Peel無法從此帳號執行此動作。"+ "value" : "只有管理者能移動這些項目,而Peel的輔助程式不能從所在位置移動它們。若要移除其中一個項目,請將它顯示於Finder並拖到「垃圾桶」,然後在macOS要求時輸入管理者名稱和密碼。"}}}},- "Only an administrator can use the helper. Log in as an administrator to remove items that need one." : {+ "Only an administrator can remove Peel’s helper, so Peel can’t remove itself from this account. Log in as an administrator and choose Remove Peel there." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Pomocníka může používat jen správce. Chcete-li odstranit položky, které správce vyžadují, přihlaste se jako správce."+ "value" : "Pomocníka Peelu může odstranit jen správce, takže Peel se z tohoto účtu odstranit nemůže. Přihlaste se jako správce a tam zvolte „Odstranit Peel“."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Nur ein Administrator kann das Hilfsprogramm verwenden. Melde dich als Administrator an, um Objekte zu entfernen, die einen benötigen."+ "value" : "Nur ein Administrator kann das Hilfsprogramm von Peel entfernen, daher kann sich Peel mit diesem Benutzeraccount nicht selbst entfernen. Melde dich als Administrator an und wähle dort „Peel entfernen“."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un administrador puede usar el asistente. Inicia sesión como administrador para eliminar los ítems que lo necesiten."+ "value" : "Solo un administrador puede eliminar el asistente de Peel, así que Peel no puede eliminarse desde esta cuenta. Inicia sesión como administrador y elige “Eliminar Peel” allí."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Seul un administrateur peut utiliser l’utilitaire. Ouvrez une session en tant qu’administrateur pour supprimer les éléments qui en nécessitent un."+ "value" : "Seul un administrateur peut supprimer l’utilitaire de Peel : Peel ne peut donc pas se supprimer depuis ce compte. Ouvrez une session en tant qu’administrateur et choisissez « Supprimer Peel » dans cette session."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Solo un amministratore può usare l’assistente. Esegui il login come amministratore per rimuovere gli elementi che lo richiedono."+ "value" : "Solo un amministratore può rimuovere l’assistente di Peel, quindi Peel non può rimuovere sé stesso da questo account. Esegui il login come amministratore e scegli “Rimuovi Peel” da lì."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "ヘルパーを使用できるのは管理者だけです。管理者が必要な項目をゴミ箱に入れるには、管理者としてログインしてください。"+ "value" : "Peelのヘルパーを取り除けるのは管理者だけのため、Peelはこのアカウントから自身をアンインストールできません。管理者としてログインし、そこで“Peelをアンインストール”を選択してください。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "관리자만 보조 프로그램을 사용할 수 있습니다. 관리자가 필요한 항목을 제거하려면 관리자로 로그인하십시오."+ "value" : "관리자만 Peel 보조 프로그램을 제거할 수 있으므로, 이 계정에서는 Peel이 자신을 제거할 수 없습니다. 관리자로 로그인한 다음 그곳에서 ‘Peel 제거’를 선택하십시오."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Alleen een beheerder kan het hulpprogramma gebruiken. Log in als beheerder om onderdelen te verwijderen waarvoor een beheerder nodig is."+ "value" : "Alleen een beheerder kan het hulpprogramma van Peel verwijderen, dus Peel kan zichzelf niet verwijderen vanuit deze account. Log in als beheerder en kies daar 'Verwijder Peel'."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Z pomocnika może korzystać tylko administrator. Zaloguj się jako administrator, aby przenieść do Kosza rzeczy, które tego wymagają."+ "value" : "Tylko administrator może odinstalować pomocnika Peel, więc Peel nie może odinstalować się z tego konta. Zaloguj się jako administrator i tam wybierz „Odinstaluj Peel”."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "Só um administrador pode usar o auxiliar. Inicie sessão como administrador para remover os itens que exigem um."+ "value" : "Só um administrador pode remover o auxiliar do Peel, então o Peel não pode se remover a partir desta conta. Inicie sessão como administrador e escolha “Remover o Peel” lá."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Doar un administrator poate folosi instrumentul de ajutor. Faceți login ca administrator pentru a elimina articolele care necesită unul."+ "value" : "Doar un administrator poate elimina instrumentul de ajutor Peel, așa că Peel nu se poate elimina din acest cont. Faceți login ca administrator și alegeți „Eliminați Peel” de acolo."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Пользоваться помощником может только администратор. Войдите как администратор, чтобы удалить объекты, для которых это нужно."+ "value" : "Удалить помощника Peel может только администратор, поэтому из этой учетной записи Peel не может удалить себя. Войдите как администратор и выберите там «Удалить Peel»."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Bara en administratör kan använda hjälpprogrammet. Logga in som administratör för att ta bort objekt som kräver det."+ "value" : "Bara en administratör kan ta bort Peels hjälpprogram, så Peel kan inte ta bort sig själv från det här kontot. Logga in som administratör och välj ”Ta bort Peel” där."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Yardımcıyı yalnızca bir yönetici kullanabilir. Yönetici gerektiren öğeleri kaldırmak için yönetici olarak oturum açın."+ "value" : "Peel’in yardımcısını yalnızca bir yönetici kaldırabilir, bu yüzden Peel kendini bu hesaptan kaldıramaz. Yönetici olarak oturum açın ve orada “Peel’i Kaldır” düğmesini tıklayın."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Користуватися помічником може лише адміністратор. Щоб вилучити елементи, які цього потребують, увійдіть як адміністратор."+ "value" : "Вилучити помічника Peel може лише адміністратор, тож із цього облікового запису Peel не може вилучити себе. Увійдіть як адміністратор і виберіть там «Вилучити Peel»."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理员才能使用帮助程序。若要移除需要管理员权限的项目,请以管理员身份登录。"+ "value" : "只有管理员才能移除Peel的帮助程序,因此Peel无法在此账户中移除自己。请以管理员身份登录,然后在那里选取“移除Peel”。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "只有管理者能使用輔助程式。請以管理者身分登入,以移除需要管理者權限的項目。"+ "value" : "只有管理者能移除Peel的輔助程式,因此Peel無法從此帳號移除自己。請以管理者身分登入,並在那裡選擇「移除Peel」。"}}}@@ -132450,6 +132555,112 @@}}},+ "Peel asks for an administrator’s name and password each time this account needs the helper." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel si pokaždé, když tento účet potřebuje pomocníka, vyžádá jméno a heslo správce."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel fragt jedes Mal nach Namen und Passwort eines Administrators, wenn dieser Benutzeraccount das Hilfsprogramm benötigt."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel pide el nombre y la contraseña de un administrador cada vez que esta cuenta necesita el asistente."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel demande le nom et le mot de passe d’un administrateur chaque fois que ce compte a besoin de l’utilitaire."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel chiede il nome e la password di un amministratore ogni volta che questo account ha bisogno dell’assistente."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このアカウントでヘルパーが必要になるたびに、Peelは管理者の名前とパスワードを求めます。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "이 계정에서 보조 프로그램이 필요할 때마다 Peel이 관리자 이름 및 암호를 요청합니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel vraagt om de naam en het wachtwoord van een beheerder telkens wanneer deze account het hulpprogramma nodig heeft."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel prosi o nazwę i hasło administratora za każdym razem, gdy to konto potrzebuje pomocnika."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel pede o nome e a senha de um administrador sempre que esta conta precisar do auxiliar."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel cere numele și parola unui administrator de fiecare dată când acest cont are nevoie de instrumentul de ajutor."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel запрашивает имя и пароль администратора каждый раз, когда этой учетной записи нужен помощник."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel ber om en administratörs namn och lösenord varje gång det här kontot behöver hjälpprogrammet."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel, bu hesap yardımcıya her ihtiyaç duyduğunda bir yönetici adı ve parolası ister."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel запитує імʼя та пароль адміністратора щоразу, коли цьому обліковому запису потрібен помічник."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此账户每次需要帮助程序时,Peel都会要求输入管理员名称和密码。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "每當此帳號需要使用輔助程式時,Peel都會要求輸入管理者的名稱和密碼。"+ }+ }+ }+ },"Peel can only put back what is still there." : {"localizations" : {"cs" : {@@ -210586,6 +210797,112 @@}}},+ "This account isn’t an administrator, so Peel’s helper does this only with an administrator’s approval." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tento účet není účtem správce, takže to pomocník Peelu provede jen se schválením správce."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dieser Benutzeraccount hat keine Administratorrechte, daher erledigt das Hilfsprogramm von Peel dies nur mit der Erlaubnis eines Administrators."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Esta cuenta no es de administrador, así que el asistente de Peel solo realiza esta operación con la aprobación de un administrador."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ce compte n’est pas administrateur : l’utilitaire de Peel n’effectue donc cette opération qu’avec l’approbation d’un administrateur."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Questo non è un account di amministratore, quindi l’assistente di Peel esegue questa operazione solo con l’approvazione di un amministratore."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このアカウントは管理者ではないため、Peelのヘルパーは管理者の承認がある場合にのみこの操作を行います。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "이 계정은 관리자가 아니므로, Peel 보조 프로그램은 관리자의 승인이 있어야만 이 작업을 수행합니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Deze account heeft geen beheerdersrechten, dus het hulpprogramma van Peel doet dit alleen met toestemming van een beheerder."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "To konto nie jest kontem administratora, więc pomocnik Peel wykona to tylko za zgodą administratora."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Esta conta não é de administrador, então o auxiliar do Peel só faz isso com a aprovação de um administrador."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Acest cont nu este un cont de administrator, așa că instrumentul de ajutor Peel face acest lucru doar cu aprobarea unui administrator."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "У этой учетной записи нет прав администратора, поэтому помощник Peel выполняет это действие только с разрешения администратора."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Det här kontot är inte ett administratörskonto, så Peels hjälpprogram gör det här bara med en administratörs godkännande."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bu hesap bir yönetici hesabı değil, bu yüzden Peel’in yardımcısı bunu yalnızca bir yöneticinin onayıyla yapar."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Цей обліковий запис не має прав адміністратора, тому помічник Peel виконує цю дію лише зі схвалення адміністратора."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此账户不是管理员,因此只有在管理员批准后,Peel的帮助程序才会执行此操作。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此帳號不是管理者,因此Peel的輔助程式只有在管理者核准後才會執行此動作。"+ }+ }+ }+ },"This also selects ^[%lld item](inflect: true) Peel doesn’t recommend removing. Check each one before you move it, or select only what Peel recommends." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swiftindex 3fd5b3d2..c64b3fbd 100644--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swift+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swift@@ -155,16 +155,19 @@ public enum BackgroundItemActions {public static func moveToTrash(_ item: BackgroundItem, exclusions: Exclusions = .none) async throws(Failure) -> Moved {- try await moveToTrash(- item,- isHelperEnabled: PrivilegedHelper.status == .enabled,- trash: TrashService(exclusions: exclusions)- ) { item in- do throws(Failure) {- try await stop(item)- return nil- } catch {- return error+ // The file's move and the job's stop after it share one administrator's approval.+ try await PrivilegedHelper.withOneConsent { () async throws(Failure) -> Moved in+ try await moveToTrash(+ item,+ isHelperEnabled: PrivilegedHelper.status == .enabled,+ trash: TrashService(exclusions: exclusions)+ ) { item in+ do throws(Failure) {+ try await stop(item)+ return nil+ } catch {+ return error+ }}}}diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/AdministratorConsent.swift b/Packages/PeelCore/Sources/PeelCore/Removal/AdministratorConsent.swiftnew file mode 100644index 00000000..5b2d62ab--- /dev/null+++ b/Packages/PeelCore/Sources/PeelCore/Removal/AdministratorConsent.swift@@ -0,0 +1,97 @@+public import Foundation+import PeelPrivileged+import Security++/// One administrator's approval for one action of an account that isn't an administrator: asked for when the action+/// first needs the helper, carried by each of its requests, and destroyed once the action ends.+actor AdministratorConsent {+ struct Approval: Sendable {+ let form: Data+ let destroy: @Sendable () -> Void+ }++ private let isAdministrator: @Sendable () async -> Bool+ private let ask: @Sendable () async -> Approval?+ private var answer: Task<Approval?, Never>?++ init(+ isAdministrator: @escaping @Sendable () async -> Bool = { await PrivilegedHelper.isAdministratorNow() },+ ask: @escaping @Sendable () async -> Approval? = { await AdministratorConsent.askAnAdministrator() }+ ) {+ self.isAdministrator = isAdministrator+ self.ask = ask+ }++ /// What each request of the action carries: nothing from an administrator, whom the helper serves as one, and+ /// otherwise the approval an administrator gave, asked for the first time it is needed. Nil when none gave it.+ func approval() async -> Data? {+ let answer = self.answer ?? Task { [isAdministrator, ask] in+ await isAdministrator() ? Approval(form: Data(), destroy: {}) : await ask()+ }+ self.answer = answer+ return await answer.value?.form+ }++ /// Destroys the approval, so nothing can use it once the action is over.+ func end() async {+ await answer?.value?.destroy()+ }++ /// Asks for an administrator's name and password in macOS's own window, on a thread of its own, since the window+ /// holds the thread until it closes.+ static func askAnAdministrator(prompt: String? = PrivilegedHelper.consentPrompt) async -> Approval? {+ await withCheckedContinuation { continuation in+ DispatchQueue.global(qos: .userInitiated).async {+ continuation.resume(returning: approvalFromAnAdministrator(prompt: prompt))+ }+ }+ }++ private static func approvalFromAnAdministrator(prompt: String?) -> Approval? {+ var made: AuthorizationRef?+ guard AuthorizationCreate(nil, nil, [], &made) == errAuthorizationSuccess, let made else { return nil }+ let authorization = Authorization(made)+ // Pre-authorized, the approval holds in the helper, which checks it without asking anybody.+ let flags: AuthorizationFlags = [.interactionAllowed, .extendRights, .preAuthorize]+ let status = AdministratorAuthorization.withRight { rights in+ withEnvironment(prompt) { AuthorizationCopyRights(made, &rights, $0, flags, nil) }+ }+ var external = AuthorizationExternalForm()+ guard status == errAuthorizationSuccess,+ AuthorizationMakeExternalForm(made, &external) == errAuthorizationSuccess+ else {+ authorization.destroy()+ return nil+ }+ return Approval(form: withUnsafeBytes(of: &external) { Data($0) }, destroy: authorization.destroy)+ }++ private static func withEnvironment<T>(+ _ prompt: String?, _ body: (UnsafePointer<AuthorizationEnvironment>?) -> T+ ) -> T {+ guard let prompt else { return body(nil) }+ return kAuthorizationEnvironmentPrompt.withCString { name in+ var text = Array(prompt.utf8)+ return text.withUnsafeMutableBytes { bytes in+ var item = AuthorizationItem(name: name, valueLength: bytes.count, value: bytes.baseAddress, flags: 0)+ return withUnsafeMutablePointer(to: &item) { pointer in+ var environment = AuthorizationEnvironment(count: 1, items: pointer)+ return body(&environment)+ }+ }+ }+ }++ /// An authorization, which macOS keeps until it is freed, from any thread.+ private final class Authorization: @unchecked Sendable {+ private let reference: AuthorizationRef++ init(_ reference: AuthorizationRef) {+ self.reference = reference+ }++ func destroy() {+ AuthorizationFree(reference, [.destroyRights])+ }+ }+}diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/PrivilegedHelper.swift b/Packages/PeelCore/Sources/PeelCore/Removal/PrivilegedHelper.swiftindex 0aeceb6a..51683d20 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/PrivilegedHelper.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/PrivilegedHelper.swift@@ -21,15 +21,19 @@ public enum PrivilegedHelper {case notThisAccountcase notAnswering- /// A standard account comes first: the helper serves administrators only, so its registration says nothing- /// that account could act on.- public init(status: Status, isAvailableToThisAccount: Bool, isResponding: Bool?) {- guard isAvailableToThisAccount else {+ /// Another account uses a helper that works, with an administrator's approval for each action, and anything+ /// else needs an administrator: only one installs, approves, or repairs the helper.+ public init(status: Status, isAdministrator: Bool, isResponding: Bool?) {+ if status == .enabled, isResponding != false {+ self = .ready+ return+ }+ guard isAdministrator else {self = .notThisAccountreturn}self = switch status {- case .enabled: isResponding == false ? .notAnswering : .ready+ case .enabled: .notAnsweringcase .requiresApproval: .waitingForApprovalcase .notRegistered, .unavailable: .notInstalled}@@ -112,16 +116,50 @@ public enum PrivilegedHelper {return unregistering}- /// True when this account is an administrator. The helper's Mach service can be reached from every account- /// on the Mac, so the helper serves administrators only, and a standard account gets nothing from it.- public static var isAvailableToThisAccount: Bool {+ /// True when this account is an administrator, whom the helper serves as one. Any other account needs an+ /// administrator's approval for each action (`AdministratorConsent`).+ public static var isAdministrator: Bool {UserAuthorization.isAdministrator(getuid())}- /// `isAvailableToThisAccount`, asked away from the caller's actor: the answer comes from opendirectoryd.+ /// `isAdministrator`, asked away from the caller's actor: the answer comes from opendirectoryd.@concurrent- public static func currentAvailability() async -> Bool {- isAvailableToThisAccount+ public static func isAdministratorNow() async -> Bool {+ isAdministrator+ }++ /// The words macOS's window shows under its own when Peel asks an administrator, in the reader's language, which+ /// the app sets: PeelCore has no catalog.+ public static var consentPrompt: String? {+ get { prompt.withLock { $0 } }+ set { prompt.withLock { $0 = newValue } }+ }++ private static let prompt = Mutex<String?>(nil)++ /// The approval the requests of the action under way carry.+ @TaskLocal static var consent: AdministratorConsent?++ /// Runs `body` with one approval for all of its requests to the helper, asked for at the first that needs one and+ /// destroyed when `body` ends, or within an action already under way with that action's.+ public static func withOneConsent<T, E: Error>(_ body: () async throws(E) -> T) async throws(E) -> T {+ try await withOneConsent(AdministratorConsent(), body)+ }++ static func withOneConsent<T, E: Error>(+ _ made: @autoclosure () -> AdministratorConsent, _ body: () async throws(E) -> T+ ) async throws(E) -> T {+ if consent != nil { return try await body() }+ let consent = made()+ let result: Result<T, E> = await $consent.withValue(consent) {+ do throws(E) {+ return .success(try await body())+ } catch {+ return .failure(error)+ }+ }+ await consent.end()+ return try result.get()}/// Runs `change` only while this account is an administrator, asked again now: macOS lets any account unregister@@ -129,7 +167,7 @@ public enum PrivilegedHelper {@discardableResultpublic static func changeAsAnAdministrator(_ change: () async throws -> Void,- isAdministrator: () async -> Bool = { await currentAvailability() }+ isAdministrator: () async -> Bool = { await isAdministratorNow() }) async throws -> Bool {guard await isAdministrator() else { return false }try await change()@@ -238,8 +276,12 @@ public enum PrivilegedHelper {// Read before the move, so that if the answer is lost, moved items can be found in the Trash by identity.let links = Dictionary(urls.map { ($0, FileIdentity.Link.of($0)) }, uniquingKeysWith: { first, _ in first })let paths = urls.map { $0.path(percentEncoded: false) }- let reply: HelperTrashReply? = await withHelper(fallback: nil) { helper, finish in- helper.moveItemsToTrash(version: HelperIdentity.protocolVersion, atPaths: paths) { moved, failed in+ let notAuthorized = Dictionary(paths.map { ($0, HelperRefusal.notAuthorized.rawValue) }) { first, _ in first }+ let refused = HelperTrashReply(moved: [:], failed: notAuthorized)+ let reply: HelperTrashReply? = await withHelper(fallback: nil, refused: refused) { helper, approval, finish in+ helper.moveItemsToTrash(+ version: HelperIdentity.protocolVersion, approval: approval, atPaths: paths+ ) { moved, failed infinish(HelperTrashReply(moved: moved, failed: failed))}}@@ -288,9 +330,11 @@ public enum PrivilegedHelper {/// Returns nil on success, or a failure description.@concurrentstatic func runDaemonCommand(_ command: DaemonCommand, label: String) async -> String? {- await withHelper(fallback: Self.unavailable) { helper, finish in+ await withHelper(fallback: Self.unavailable, refused: HelperRefusal.notAuthorized.rawValue) {+ helper, approval, finish inhelper.runDaemonCommand(version: HelperIdentity.protocolVersion,+ approval: approval,command: command.rawValue,label: label) { failure in@@ -317,7 +361,10 @@ public enum PrivilegedHelper {public static func moveLedgerToTrash() async -> LedgerMove {let folder = ledgerFolderguard folder.isThere else { return .none }- let failure: String? = await withHelper(fallback: Self.unavailable) { helper, finish in+ // Only an administrator removes Peel, and the helper serves one with no approval.+ let failure: String? = await request(+ connecting: helperConnection, fallback: Self.unavailable, refused: Self.unavailable, approval: { Data() }+ ) { helper, _, finish inhelper.moveLedgerToTrash(version: HelperIdentity.protocolVersion) { failure infinish(failure)}@@ -328,9 +375,11 @@ public enum PrivilegedHelper {/// Returns nil on success, or a failure description.@concurrentstatic func restore(_ item: TrashedItem) async -> String? {- await withHelper(fallback: Self.unavailable) { helper, finish in+ await withHelper(fallback: Self.unavailable, refused: HelperRefusal.notAuthorized.rawValue) {+ helper, approval, finish inhelper.restoreItem(version: HelperIdentity.protocolVersion,+ approval: approval,fromTrashPath: item.trashedURL.path(percentEncoded: false),toPath: item.originalURL.path(percentEncoded: false)) { failure in@@ -344,7 +393,7 @@ public enum PrivilegedHelper {/// would stop Peel when Swift reads them.static func remoteInterface() -> NSXPCInterface {let interface = NSXPCInterface(with: (any PeelHelperProtocol).self)- let trash = #selector((any PeelHelperProtocol).moveItemsToTrash(version:atPaths:withReply:))+ let trash = #selector((any PeelHelperProtocol).moveItemsToTrash(version:approval:atPaths:withReply:))let strings = NSSet(array: [NSDictionary.self, NSString.self]) as? Set<AnyHashable> ?? []for index in 0...1 {interface.setClasses(strings, for: trash, argumentIndex: index, ofReply: true)@@ -352,23 +401,37 @@ public enum PrivilegedHelper {return interface}+ /// Sends a request that changes something with the approval of the action under way, and answers `refused` when no+ /// administrator gave one.private static func withHelper<T: Sendable>(fallback: T,- _ body: @escaping @Sendable (any PeelHelperProtocol, @escaping @Sendable (T) -> Void) -> Void+ refused: T,+ _ body: @escaping @Sendable (any PeelHelperProtocol, Data, @escaping @Sendable (T) -> Void) -> Void) async -> T {- await request(connecting: helperConnection, fallback: fallback, body)+ await withOneConsent {+ await request(+ connecting: helperConnection, fallback: fallback, refused: refused,+ approval: { await consent?.approval() }, body+ )+ }}/// Sends a request only once the helper has answered, within its own short wait, on a connection of its own: a/// helper launchd keeps but cannot start never answers, and the request would wait the longest any request may.+ /// The approval is asked for only then, so nobody is asked for what can't be done.static func request<T: Sendable>(connecting connect: @escaping @Sendable () -> NSXPCConnection?,answerWait wait: TimeInterval = answerWait,fallback: T,- _ body: @escaping @Sendable (any PeelHelperProtocol, @escaping @Sendable (T) -> Void) -> Void+ refused: T,+ approval: () async -> Data?,+ _ body: @escaping @Sendable (any PeelHelperProtocol, Data, @escaping @Sendable (T) -> Void) -> Void) async -> T {guard await isResponding(connecting: connect, waitingAtMost: wait) else { return fallback }- return await ask(connecting: connect, waitingAtMost: requestWait, fallback: fallback, body)+ guard let approval = await approval() else { return refused }+ return await ask(connecting: connect, waitingAtMost: requestWait, fallback: fallback) { helper, finish in+ body(helper, approval, finish)+ }}/// A connection that takes only the helper's own code, or nil when Peel has no team to require.diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/SelfRemoval.swift b/Packages/PeelCore/Sources/PeelCore/Removal/SelfRemoval.swiftindex a9704790..c7843afd 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/SelfRemoval.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/SelfRemoval.swift@@ -29,7 +29,7 @@ public enum SelfRemoval {self.init(helperIsRegistered: helperIsRegistered,helperIsEnabled: helperIsEnabled,- helperMayBeChanged: { await PrivilegedHelper.currentAvailability() },+ helperMayBeChanged: { await PrivilegedHelper.isAdministratorNow() },helperAnswers: { await PrivilegedHelper.isResponding() },moveLedger: { await PrivilegedHelper.moveLedgerToTrash() },ledger: PrivilegedHelper.ledgerFolder,diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swiftindex 8139be78..6b0d9629 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift@@ -585,7 +585,9 @@ public struct TrashService: Sendable {public func trash(_ urls: [URL], usingHelperFor privilegedURLs: Set<URL>, lettingTheirProgramsRun running: Set<URL> = []) async -> TrashResult {- await trash(urls, usingHelperFor: privilegedURLs, removal: UUID(), lettingTheirProgramsRun: running)+ await PrivilegedHelper.withOneConsent {+ await trash(urls, usingHelperFor: privilegedURLs, removal: UUID(), lettingTheirProgramsRun: running)+ }}/// Moves `apps` first, then what `files` returns for the apps that stayed, as one removal. An app's files wait@@ -600,7 +602,22 @@ public struct TrashService: Sendable {lettingTheirProgramsRun running: Set<URL>,emptiedFoldersNamed names: Set<String> = []) async -> TrashResult {- let removal = UUID()+ await PrivilegedHelper.withOneConsent {+ await trash(+ apps: apps, thenFiles: files, usingHelperFor: privilegedURLs, lettingTheirProgramsRun: running,+ emptiedFoldersNamed: names, removal: UUID()+ )+ }+ }++ private func trash(+ apps: [URL],+ thenFiles files: @Sendable (_ appsThatStayed: Set<URL>) -> [URL],+ usingHelperFor privilegedURLs: Set<URL>,+ lettingTheirProgramsRun running: Set<URL>,+ emptiedFoldersNamed names: Set<String>,+ removal: UUID+ ) async -> TrashResult {// Asked before anything moves: a job stopped so its app could move is no longer named by launchd.var registrations: [URL: StartsAtLogin.Registration] = [:]for app in apps {@@ -818,6 +835,10 @@ public struct TrashService: Sendable {/// its extensions, which would make their containers again before the ones in the Trash went back.@concurrentpublic func restore(_ items: [TrashedItem], canUseHelper: Bool = false) async -> Restored {+ await PrivilegedHelper.withOneConsent { await putBack(items, canUseHelper: canUseHelper) }+ }++ private func putBack(_ items: [TrashedItem], canUseHelper: Bool) async -> Restored {var restored = Restored()for item in items {let answer = await putBack(item, canUseHelper: canUseHelper)diff --git a/Packages/PeelCore/Sources/PeelCore/Support/FixedSentence.swift b/Packages/PeelCore/Sources/PeelCore/Support/FixedSentence.swiftindex ac49640e..af4e027f 100644--- a/Packages/PeelCore/Sources/PeelCore/Support/FixedSentence.swift+++ b/Packages/PeelCore/Sources/PeelCore/Support/FixedSentence.swift@@ -10,7 +10,8 @@ public enum FixedSentence: CaseIterable, Sendable {case onlyAppsTherecase notThereAnymore, alreadyThere, protectedByMacOS, irreplaceable, codeFolder, onlyLinksThere, leadsSomewherecase onlyGoneProgramsThere- case helperOutOfDate, accountNotAllowed, tooManyItems, noTrash, pathTooLong, cannotKeepRecord, cannotReadRecord+ case helperOutOfDate, accountNotAllowed, notAuthorized, tooManyItems, noTrash, pathTooLong, cannotKeepRecord+ case cannotReadRecordcase notInTrash, notInHelpersRecord, invalidRequest, configurationMissing, declaredTwicecase toolTimedOut, toolStoppedcase receiptMisplaced, receiptForgotten, homebrewNotInstalled, helperUnavailable@@ -40,6 +41,7 @@ public enum FixedSentence: CaseIterable, Sendable {case .onlyGoneProgramsThere: PrivilegedPathPolicy.Rejection.startsAProgram.explanationcase .helperOutOfDate: HelperRefusal.outOfDate.rawValuecase .accountNotAllowed: HelperRefusal.notAllowed.rawValue+ case .notAuthorized: HelperRefusal.notAuthorized.rawValuecase .tooManyItems: HelperRefusal.tooManyItems.rawValuecase .noTrash: HelperRefusal.noTrash.rawValuecase .pathTooLong: HelperRefusal.pathTooLong.rawValuediff --git a/Packages/PeelCore/Sources/PeelPrivileged/AdministratorAuthorization.swift b/Packages/PeelCore/Sources/PeelPrivileged/AdministratorAuthorization.swiftnew file mode 100644index 00000000..813db07f--- /dev/null+++ b/Packages/PeelCore/Sources/PeelPrivileged/AdministratorAuthorization.swift@@ -0,0 +1,38 @@+public import Foundation+public import Security++/// An administrator's approval of what an account that isn't one asks the helper for. Peel asks for it, macOS shows+/// its own window for an administrator's name and password, and the helper checks it without asking anybody.+public enum AdministratorAuthorization {+ /// The right Peel asks an administrator for. macOS defines it, so no process of a standard account can define it+ /// as granted to anybody, and it keeps an approval in that one authorization alone, for five minutes+ /// (`security authorizationdb read system.privilege.admin`).+ public static let right = kAuthorizationRightExecute++ /// Whether `form`, an authorization's external form, holds an administrator's approval now.+ public static func isGranted(by form: Data) -> Bool {+ guard form.count == Int(kAuthorizationExternalFormLength) else { return false }+ var external = AuthorizationExternalForm()+ withUnsafeMutableBytes(of: &external) { _ = form.copyBytes(to: $0) }+ var authorization: AuthorizationRef?+ guard AuthorizationCreateFromExternalForm(&external, &authorization) == errAuthorizationSuccess,+ let authorization+ else { return false }+ defer { AuthorizationFree(authorization, []) }+ // Without `interactionAllowed`, macOS shows nothing and answers only from what the authorization holds.+ return withRight { rights in+ AuthorizationCopyRights(authorization, &rights, nil, [.extendRights], nil) == errAuthorizationSuccess+ }+ }++ /// Runs `body` with a set of rights holding `right` alone.+ public static func withRight<T>(_ body: (inout AuthorizationRights) -> T) -> T {+ right.withCString { name in+ var item = AuthorizationItem(name: name, valueLength: 0, value: nil, flags: 0)+ return withUnsafeMutablePointer(to: &item) { pointer in+ var rights = AuthorizationRights(count: 1, items: pointer)+ return body(&rights)+ }+ }+ }+}diff --git a/Packages/PeelCore/Sources/PeelPrivileged/HelperInterface.swift b/Packages/PeelCore/Sources/PeelPrivileged/HelperInterface.swiftindex 58609d00..72e38fdd 100644--- a/Packages/PeelCore/Sources/PeelPrivileged/HelperInterface.swift+++ b/Packages/PeelCore/Sources/PeelPrivileged/HelperInterface.swift@@ -1,4 +1,4 @@-import Foundation+public import Foundationpublic enum HelperIdentity {public static let appIdentifier = "com.tuguidragos.Peel"@@ -15,7 +15,8 @@ public enum HelperIdentity {/// Each call carries the protocol version of the app making it. Any administrator can write to/// `/Applications`, so an older copy of Peel, signed by the same team but with older checks, can be put/// there. The helper answers only the version it was installed with, and only a build no older than its own, so-/// that copy gets nothing from it.+/// that copy gets nothing from it. A request that changes anything carries `approval`: empty from an administrator,+/// and from any other account the external form of an administrator's approval (`AdministratorAuthorization`).@objc public protocol PeelHelperProtocol {func protocolVersion(withReply reply: @escaping @Sendable (Int) -> Void)@@ -23,6 +24,7 @@ public enum HelperIdentity {/// Trash, and why each other item failed.func moveItemsToTrash(version: Int,+ approval: Data,atPaths paths: [String],withReply reply: @escaping @Sendable ([String: String], [String: String]) -> Void)@@ -31,6 +33,7 @@ public enum HelperIdentity {/// failure description.func runDaemonCommand(version: Int,+ approval: Data,command: String,label: String,withReply reply: @escaping @Sendable (String?) -> Void@@ -40,13 +43,14 @@ public enum HelperIdentity {/// exactly there. Replies with nil on success, or a failure description.func restoreItem(version: Int,+ approval: Data,fromTrashPath trashPath: String,toPath destination: String,withReply reply: @escaping @Sendable (String?) -> Void)- /// Moves the helper's own ledger to the user's Trash, for Remove Peel just before it unregisters the helper.- /// Replies with nil once it is there or when there is none, or a failure description.+ /// Moves the helper's own ledger to the user's Trash, for Remove Peel just before it unregisters the helper, which+ /// only an administrator does. Replies with nil once it is there or when there is none, or a failure description.func moveLedgerToTrash(version: Int, withReply reply: @escaping @Sendable (String?) -> Void)}diff --git a/Packages/PeelCore/Sources/PeelPrivileged/HelperLifetime.swift b/Packages/PeelCore/Sources/PeelPrivileged/HelperLifetime.swiftindex c8b5ff0a..89c4f726 100644--- a/Packages/PeelCore/Sources/PeelPrivileged/HelperLifetime.swift+++ b/Packages/PeelCore/Sources/PeelPrivileged/HelperLifetime.swift@@ -42,18 +42,12 @@ public final class HelperLifetime: Sendable {scheduleExitIfIdle(generation: 0)}- /// Accepts a connection when `isAllowed` answers yes, and counts it until `connectionClosed()`. It is counted- /// before `isAllowed` is asked, since that can take a while and the helper must not exit meanwhile.- public func accept(_ isAllowed: () -> Bool) -> Bool {+ /// Counts a connection until `connectionClosed()`.+ public func connectionOpened() {state.withLock { state instate.activeConnections += 1state.generation += 1}- guard isAllowed() else {- connectionClosed()- return false- }- return true}/// Counts a request as running until `requestFinished()`. The connection count alone is not enough: adiff --git a/Packages/PeelCore/Sources/PeelPrivileged/HelperRefusal.swift b/Packages/PeelCore/Sources/PeelPrivileged/HelperRefusal.swiftindex a927ee51..a4258900 100644--- a/Packages/PeelCore/Sources/PeelPrivileged/HelperRefusal.swift+++ b/Packages/PeelCore/Sources/PeelPrivileged/HelperRefusal.swift@@ -4,6 +4,8 @@public enum HelperRefusal: String, CaseIterable, Sendable {case outOfDate = "Peel’s helper is out of date. Reinstall it in Settings."case notAllowed = "This account isn’t allowed to use Peel’s helper."+ /// An account that isn't an administrator asked without an administrator's approval in force.+ case notAuthorized = "An administrator didn’t allow this."case tooManyItems = "Too many items in one request."case noTrash = "There’s no Trash to move this to."case pathTooLong = "The path is too long."diff --git a/Packages/PeelCore/Sources/PeelPrivileged/HelperRequest.swift b/Packages/PeelCore/Sources/PeelPrivileged/HelperRequest.swiftindex 312626b1..3ae076e3 100644--- a/Packages/PeelCore/Sources/PeelPrivileged/HelperRequest.swift+++ b/Packages/PeelCore/Sources/PeelPrivileged/HelperRequest.swift@@ -1,4 +1,5 @@public import Darwin+public import Foundation/// The checks every request to the helper passes before any work, in the order they are made: what costs nothing/// comes first, and the account behind the connection is asked last, once the request is known to be sound.@@ -24,13 +25,26 @@ public enum HelperRequest {version: Int,items: Int = 0,paths: [String] = [],- caller: () -> Caller?+ caller: () -> Result<Caller, HelperRefusal>) -> Result<Caller, HelperRefusal> {guard version == HelperIdentity.protocolVersion else { return .failure(.outOfDate) }guard items <= maximumItems else { return .failure(.tooManyItems) }guard !paths.contains(where: isTooLong) else { return .failure(.pathTooLong) }- guard let caller = caller() else { return .failure(.notAllowed) }- return .success(caller)+ return caller()+ }++ /// The account the helper serves a request for, with its home folder, which the helper's rules need.+ public static func caller(+ user: uid_t?,+ approval: Data,+ isAdministrator: (uid_t) -> Bool = UserAuthorization.isAdministrator,+ isApproved: (Data) -> Bool = AdministratorAuthorization.isGranted(by:),+ homeDirectory: (uid_t) -> String? = UserAuthorization.homeDirectory(of:)+ ) -> Result<Caller, HelperRefusal> {+ guard let user, let home = homeDirectory(user) else { return .failure(.notAllowed) }+ // An administrator is served as one, and only another account's approval costs a question to macOS.+ guard isAdministrator(user) || isApproved(approval) else { return .failure(.notAuthorized) }+ return .success(Caller(user: user, homeDirectory: home))}public static func isTooLong(_ path: String) -> Bool {diff --git a/Packages/PeelCore/Sources/PeelPrivileged/UserAuthorization.swift b/Packages/PeelCore/Sources/PeelPrivileged/UserAuthorization.swiftindex 648b5bc6..a406fb03 100644--- a/Packages/PeelCore/Sources/PeelPrivileged/UserAuthorization.swift+++ b/Packages/PeelCore/Sources/PeelPrivileged/UserAuthorization.swift@@ -3,8 +3,9 @@ private import Darwin.membership/// Decides who the helper works for. Its Mach service is advertised in the system domain, so every account/// on the Mac can reach it, including a standard account or a second one logged in at the same time. What-/// it does, such as moving files inside `/Library`, belongs to root alone, so it answers only the accounts-/// macOS trusts with administration, and refuses whenever that cannot be established.+/// it does, such as moving files inside `/Library`, belongs to root alone, so it answers an account macOS trusts+/// with administration, or another account only with an administrator's approval (`AdministratorAuthorization`),+/// and refuses whenever neither can be established.public enum UserAuthorization {private static let administratorsGroup = "admin"diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AdministratorAuthorizationTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AdministratorAuthorizationTests.swiftnew file mode 100644index 00000000..a420e819--- /dev/null+++ b/Packages/PeelCore/Tests/PeelCoreTests/AdministratorAuthorizationTests.swift@@ -0,0 +1,37 @@+import Foundation+import PeelPrivileged+import Security+import Testing++struct AdministratorAuthorizationTests {+ @Test func noApprovalHoldsWithoutAnAuthorization() {+ #expect(!AdministratorAuthorization.isGranted(by: Data()))+ #expect(!AdministratorAuthorization.isGranted(by: Data(repeating: 1, count: 31)))+ #expect(!AdministratorAuthorization.isGranted(by: Data((0..<32).map { _ in UInt8.random(in: 0...255) })))+ }++ @Test func anAuthorizationNoAdministratorApprovedHoldsNothing() throws {+ var authorization: AuthorizationRef?+ #expect(AuthorizationCreate(nil, nil, [], &authorization) == errAuthorizationSuccess)+ let made = try #require(authorization)+ defer { AuthorizationFree(made, [.destroyRights]) }+ var external = AuthorizationExternalForm()+ #expect(AuthorizationMakeExternalForm(made, &external) == errAuthorizationSuccess)+ let form = withUnsafeBytes(of: &external) { Data($0) }++ #expect(form.count == 32)+ #expect(!AdministratorAuthorization.isGranted(by: form))+ }++ @Test func macOSKeepsTheRightForAnAdministratorAndThatAuthorizationAlone() throws {+ var definition: CFDictionary?+ #expect(AuthorizationRightGet(AdministratorAuthorization.right, &definition) == errAuthorizationSuccess)+ let rule = try #require(definition as? [String: Any])++ #expect(rule["class"] as? String == "user")+ #expect(rule["group"] as? String == "admin")+ #expect(rule["authenticate-user"] as? Bool == true)+ #expect(rule["shared"] as? Bool == false)+ #expect((rule["timeout"] as? Int ?? 0) > 0)+ }+}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AdministratorConsentTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AdministratorConsentTests.swiftnew file mode 100644index 00000000..a1175272--- /dev/null+++ b/Packages/PeelCore/Tests/PeelCoreTests/AdministratorConsentTests.swift@@ -0,0 +1,86 @@+import Foundation+@testable import PeelCore+import Synchronization+import Testing++private final class Asked: Sendable {+ private let counts = Mutex((asked: 0, destroyed: 0))++ func ask() { counts.withLock { $0.asked += 1 } }+ func destroy() { counts.withLock { $0.destroyed += 1 } }+ var asked: Int { counts.withLock { $0.asked } }+ var destroyed: Int { counts.withLock { $0.destroyed } }+}++struct AdministratorConsentTests {+ private let form = Data(repeating: 9, count: 32)++ private func consent(isAdministrator: Bool, granting: Bool = true, _ asked: Asked) -> AdministratorConsent {+ let form = form+ return AdministratorConsent(isAdministrator: { isAdministrator }) {+ asked.ask()+ return granting ? AdministratorConsent.Approval(form: form) { asked.destroy() } : nil+ }+ }++ @Test func asksOnceForEveryRequestOfAnAction() async {+ let asked = Asked()+ let consent = consent(isAdministrator: false, asked)++ async let first = consent.approval()+ async let second = consent.approval()+ let forms = await [first, second, consent.approval()]++ #expect(forms == [form, form, form])+ #expect(asked.asked == 1)+ await consent.end()+ #expect(asked.destroyed == 1)+ }++ @Test func anAdministratorIsNeverAsked() async {+ let asked = Asked()+ let consent = consent(isAdministrator: true, asked)++ #expect(await consent.approval() == Data())+ await consent.end()++ #expect(asked.asked == 0)+ #expect(asked.destroyed == 0)+ }++ @Test func noApprovalWhenNoAdministratorGivesOne() async {+ let asked = Asked()+ let consent = consent(isAdministrator: false, granting: false, asked)++ #expect(await consent.approval() == nil)+ #expect(await consent.approval() == nil)+ #expect(asked.asked == 1)+ }++ @Test func anActionWithinAnotherUsesItsApproval() async {+ let outer = Asked()+ let inner = Asked()++ let carried = await PrivilegedHelper.withOneConsent(consent(isAdministrator: false, outer)) {+ await PrivilegedHelper.withOneConsent(consent(isAdministrator: false, inner)) {+ await PrivilegedHelper.consent?.approval()+ }+ }++ #expect(carried == form)+ #expect(outer.asked == 1)+ #expect(inner.asked == 0)+ #expect(outer.destroyed == 1)+ }++ @Test func theApprovalIsDestroyedWhenTheActionEnds() async {+ let asked = Asked()++ await PrivilegedHelper.withOneConsent(consent(isAdministrator: false, asked)) {+ _ = await PrivilegedHelper.consent?.approval()+ #expect(asked.destroyed == 0)+ }++ #expect(asked.destroyed == 1)+ }+}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HelperAnswerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HelperAnswerTests.swiftindex df775dc4..ff61f29e 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HelperAnswerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HelperAnswerTests.swift@@ -230,7 +230,9 @@ struct HelperAnswerTests {let sent = Record(false)let request = await timedWhereItRuns {- await PrivilegedHelper.request(connecting: connecting, fallback: "unanswered") { _, finish in+ await PrivilegedHelper.request(+ connecting: connecting, fallback: "unanswered", refused: "refused", approval: { Data() }+ ) { _, _, finish insent.value.withLock { $0 = true }finish("answered")}@@ -246,14 +248,66 @@ struct HelperAnswerTests {defer { helper.stop() }let answer = await PrivilegedHelper.request(- connecting: helper.connecting, answerWait: Self.anyWait, fallback: "unanswered"- ) { _, finish in+ connecting: helper.connecting, answerWait: Self.anyWait, fallback: "unanswered", refused: "refused",+ approval: { Data() }+ ) { _, _, finish infinish("answered")}#expect(answer == "answered")}+ @Test func aRequestCarriesTheApprovalAskedForOnceTheHelperAnswers() async {+ let helper = StandInHelper(answering: HelperIdentity.protocolVersion)+ defer { helper.stop() }+ let approval = Data(repeating: 7, count: 32)++ let carried = await PrivilegedHelper.request(+ connecting: helper.connecting, answerWait: Self.anyWait, fallback: Data(), refused: Data(),+ approval: { approval }+ ) { _, carried, finish in+ finish(carried)+ }++ #expect(carried == approval)+ }++ @Test func nothingIsSentWithoutAnApproval() async {+ let helper = StandInHelper(answering: HelperIdentity.protocolVersion)+ defer { helper.stop() }+ let sent = Record(false)++ let answer = await PrivilegedHelper.request(+ connecting: helper.connecting, answerWait: Self.anyWait, fallback: "unanswered", refused: "refused",+ approval: { nil }+ ) { _, _, finish in+ sent.value.withLock { $0 = true }+ finish("answered")+ }++ #expect(answer == "refused")+ #expect(!sent.value.withLock { $0 })+ }++ @Test func nobodyIsAskedForAnApprovalWhenTheHelperDoesNotAnswer() async {+ let helper = StandInHelper(answering: nil)+ defer { helper.stop() }+ let asked = Record(false)++ let answer = await PrivilegedHelper.request(+ connecting: helper.connecting, answerWait: 0.2, fallback: "unanswered", refused: "refused",+ approval: {+ asked.value.withLock { $0 = true }+ return Data()+ }+ ) { _, _, finish in+ finish("answered")+ }++ #expect(answer == "unanswered")+ #expect(!asked.value.withLock { $0 })+ }+@Test func theHelperIsAskedAtTheQualityOfItsWaitWhateverTheTaskThatAsks() async {let helper = StandInHelper(answering: HelperIdentity.protocolVersion)defer { helper.stop() }@@ -261,8 +315,9 @@ struct HelperAnswerTests {let sentAt = Record<UInt32?>(nil)_ = await Task.detached(priority: .background) {- await PrivilegedHelper.request(connecting: connecting, answerWait: Self.anyWait, fallback: false) {- _, finish in+ await PrivilegedHelper.request(+ connecting: connecting, answerWait: Self.anyWait, fallback: false, refused: false, approval: { Data() }+ ) { _, _, finish insentAt.value.withLock { $0 = qos_class_self().rawValue }finish(true)}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HelperLifetimeTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HelperLifetimeTests.swiftindex a7cb04a4..c3aee842 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HelperLifetimeTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HelperLifetimeTests.swift@@ -54,39 +54,6 @@ struct HelperLifetimeTests {#expect(clock.exitCount == 1)}- @Test func staysWhileAConnectionIsBeingAccepted() {- let clock = Clock()- let lifetime = clock.lifetime()- lifetime.start()-- let accepted = lifetime.accept {- clock.runChecks()- return true- }-- #expect(accepted)- #expect(clock.exitCount == 0, "the helper exited while it was accepting a connection")- lifetime.connectionClosed()- clock.runChecks()- #expect(clock.exitCount == 1)- }-- @Test func aRefusedConnectionLeavesTheHelperFreeToExit() {- let clock = Clock()- let lifetime = clock.lifetime()- lifetime.start()-- let accepted = lifetime.accept {- clock.runChecks()- return false- }-- #expect(!accepted)- #expect(clock.exitCount == 0, "the helper exited while it was asking about a connection")- clock.runChecks()- #expect(clock.exitCount == 1, "a refused connection kept the helper running")- }-@Test func leavesAsSoonAsItIsIdleOnceAnUpdateReplacedItsProgram() throws {let folder = try TemporaryDirectory()let program = try folder.file("Peel.app/Contents/MacOS/PeelHelper")@@ -94,7 +61,7 @@ struct HelperLifetimeTests {let clock = Clock()let lifetime = clock.lifetime(program: program.path)lifetime.start()- #expect(lifetime.accept { true })+ lifetime.connectionOpened()#expect(rename(update.path, program.path) == 0)lifetime.connectionClosed()@@ -110,7 +77,7 @@ struct HelperLifetimeTests {let clock = Clock()let lifetime = clock.lifetime(program: program.path)lifetime.start()- #expect(lifetime.accept { true })+ lifetime.connectionOpened()try FileManager.default.removeItem(at: folder.url.appending(path: "Peel.app"))lifetime.connectionClosed()@@ -124,7 +91,7 @@ struct HelperLifetimeTests {let clock = Clock()let lifetime = clock.lifetime(program: program.path)lifetime.start()- #expect(lifetime.accept { true })+ lifetime.connectionOpened()lifetime.connectionClosed()diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HelperReplyTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HelperReplyTests.swiftindex 926dd360..57257fa9 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HelperReplyTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HelperReplyTests.swift@@ -6,9 +6,10 @@ import Testing/// The helper's trash method as a dishonest helper would answer it: the same selector, with replies of any kind.@objc private protocol LooseTrashReplies {- @objc(moveItemsToTrashWithVersion:atPaths:withReply:)+ @objc(moveItemsToTrashWithVersion:approval:atPaths:withReply:)func moveItemsToTrash(version: Int,+ approval: Data,atPaths paths: [String],withReply reply: @escaping (NSDictionary, NSDictionary) -> Void)@@ -23,6 +24,7 @@ private final class Answers: NSObject, LooseTrashReplies, NSXPCListenerDelegatefunc moveItemsToTrash(version: Int,+ approval: Data,atPaths paths: [String],withReply reply: @escaping (NSDictionary, NSDictionary) -> Void) {@@ -73,7 +75,8 @@ struct HelperReplyTests {let proxy = connection.remoteObjectProxyWithErrorHandler { error infinish("refused: \((error as NSError).code)")} as? any PeelHelperProtocol- proxy?.moveItemsToTrash(version: HelperIdentity.protocolVersion, atPaths: [Self.path]) { moved, _ in+ proxy?.moveItemsToTrash(version: HelperIdentity.protocolVersion, approval: Data(), atPaths: [Self.path]) {+ moved, _ infinish("accepted \(moved.count)")}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HelperRequestTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HelperRequestTests.swiftindex b4bf1748..d679894e 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HelperRequestTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HelperRequestTests.swift@@ -13,7 +13,7 @@ struct HelperRequestTests {) -> Result<HelperRequest.Caller, HelperRefusal> {HelperRequest.admit(version: version, items: items, paths: paths) {asked += 1- return someone+ return .success(someone)}}@@ -44,7 +44,50 @@ struct HelperRequestTests {@Test func refusesAnAccountThatIsNotAllowed() {#expect(throws: HelperRefusal.notAllowed) {- try HelperRequest.admit(version: HelperIdentity.protocolVersion) { nil }.get()+ try HelperRequest.admit(version: HelperIdentity.protocolVersion) { .failure(.notAllowed) }.get()+ }+ }++ @Test func servesAnAdministratorWithoutAskingForAnApproval() throws {+ var asked = 0+ let caller = try HelperRequest.caller(+ user: 501, approval: Data(), isAdministrator: { _ in true },+ isApproved: { _ in+ asked += 1+ return false+ },+ homeDirectory: { _ in "/Users/someone" }+ ).get()++ #expect(caller.user == 501)+ #expect(asked == 0)+ }++ @Test func servesAnotherAccountOnlyWithAnAdministratorsApproval() throws {+ let approval = Data(repeating: 7, count: 32)+ func caller(approved: Bool) -> Result<HelperRequest.Caller, HelperRefusal> {+ HelperRequest.caller(+ user: 502, approval: approval, isAdministrator: { _ in false },+ isApproved: { $0 == approval && approved }, homeDirectory: { _ in "/Users/standard" }+ )+ }++ #expect(try caller(approved: true).get().homeDirectory == "/Users/standard")+ #expect(throws: HelperRefusal.notAuthorized) { try caller(approved: false).get() }+ }++ @Test func refusesAConnectionWithNoAccountOrNoHome() {+ #expect(throws: HelperRefusal.notAllowed) {+ try HelperRequest.caller(+ user: nil, approval: Data(), isAdministrator: { _ in true }, isApproved: { _ in true },+ homeDirectory: { _ in "/Users/someone" }+ ).get()+ }+ #expect(throws: HelperRefusal.notAllowed) {+ try HelperRequest.caller(+ user: 501, approval: Data(), isAdministrator: { _ in true }, isApproved: { _ in true },+ homeDirectory: { _ in nil }+ ).get()}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HelperStandingTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HelperStandingTests.swiftindex 8bf5a06a..4d4a7393 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HelperStandingTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HelperStandingTests.swift@@ -23,7 +23,7 @@ struct HelperStandingTests {let turn = Turn()Task { @MainActor in turn.taken = true }- _ = await PrivilegedHelper.currentAvailability()+ _ = await PrivilegedHelper.isAdministratorNow()#expect(turn.taken)}@@ -46,22 +46,23 @@ struct HelperStandingTests {#expect(changed)}- /// The helper serves administrators only, so a standard account is never offered to install, approve or repair- /// it, whatever its registration says.- @Test func aStandardAccountNeedsAnAdministratorWhateverTheRegistration() {- for status in statuses {+ @Test func aStandardAccountUsesAHelperThatWorksAndNeedsAnAdministratorForAnythingElse() {+ func standing(_ status: PrivilegedHelper.Status, _ isResponding: Bool?) -> PrivilegedHelper.Standing {+ PrivilegedHelper.Standing(status: status, isAdministrator: false, isResponding: isResponding)+ }+ #expect(standing(.enabled, true) == .ready)+ #expect(standing(.enabled, nil) == .ready)+ #expect(standing(.enabled, false) == .notThisAccount)+ for status in statuses where status != .enabled {for isResponding in [true, false, nil] as [Bool?] {- let standing = PrivilegedHelper.Standing(- status: status, isAvailableToThisAccount: false, isResponding: isResponding- )- #expect(standing == .notThisAccount)+ #expect(standing(status, isResponding) == .notThisAccount)}}}@Test func anAdministratorSeesWhatTheRegistrationSays() {func standing(_ status: PrivilegedHelper.Status, _ isResponding: Bool?) -> PrivilegedHelper.Standing {- PrivilegedHelper.Standing(status: status, isAvailableToThisAccount: true, isResponding: isResponding)+ PrivilegedHelper.Standing(status: status, isAdministrator: true, isResponding: isResponding)}#expect(standing(.enabled, true) == .ready)#expect(standing(.enabled, nil) == .ready)diff --git a/Peel/Model/HelperModel.swift b/Peel/Model/HelperModel.swiftindex eea92a6c..1bc3ecac 100644--- a/Peel/Model/HelperModel.swift+++ b/Peel/Model/HelperModel.swift@@ -19,19 +19,17 @@ final class HelperModel {changing != nil}- /// Whether the helper can move items: it is registered, this account may use it, and it has not failed to- /// answer. Otherwise the items that need it stay locked.+ /// Whether the helper can move items: it is registered and has not failed to answer, and for an account that isn't+ /// an administrator each action asks an administrator first. Otherwise the items that need it stay locked.var canAct: Bool {standing == .ready}var standing: PrivilegedHelper.Standing {- PrivilegedHelper.Standing(- status: status, isAvailableToThisAccount: isAvailableToThisAccount, isResponding: isResponding- )+ PrivilegedHelper.Standing(status: status, isAdministrator: isAdministrator, isResponding: isResponding)}- private(set) var isAvailableToThisAccount = PrivilegedHelper.isAvailableToThisAccount+ private(set) var isAdministrator = PrivilegedHelper.isAdministrator/// True when a Peel helper is registered, but not by this copy of Peel. Registration belongs to a bundle,/// so a second copy (in a build folder, or a download beside the one in Applications) reads "not installed"@@ -44,15 +42,14 @@ final class HelperModel {func checkConnection() async {let check = checks.start()let status = await PrivilegedHelper.currentStatus()- let isAvailableToThisAccount = await PrivilegedHelper.currentAvailability()- // The helper answers administrators only, so another account doesn't ask it.- let isResponding = status == .enabled && isAvailableToThisAccount ? await PrivilegedHelper.isResponding() : nil+ let isAdministrator = await PrivilegedHelper.isAdministratorNow()+ let isResponding = status == .enabled ? await PrivilegedHelper.isResponding() : nillet isRegisteredByAnotherCopy = status == .notRegistered? await PrivilegedHelper.isRegisteredByAnyCopy(): falseguard checks.mayShow(check) else { return }self.status = status- self.isAvailableToThisAccount = isAvailableToThisAccount+ self.isAdministrator = isAdministratorself.isResponding = isRespondingself.isRegisteredByAnotherCopy = isRegisteredByAnotherCopyhasChecked = truediff --git a/Peel/Model/HomeModel.swift b/Peel/Model/HomeModel.swiftindex 032b125c..2183132f 100644--- a/Peel/Model/HomeModel.swift+++ b/Peel/Model/HomeModel.swift@@ -79,7 +79,7 @@ final class HomeModel {case offcase missingcase pending- /// Only an administrator account can use it, so this account has nothing to set up here.+ /// Only an administrator can set it up, so this account has nothing to do here.case notThisAccount/// The helper's row until the helper is first checked, which can take the whole of the check's wait.case checking@@ -252,7 +252,7 @@ final class HomeModel {isOnThePath: CommandLineTool.isOnThePath(embedded: Bundle.main.bundleURL.appending(path: "Contents/Helpers/peel")),- isAdministrator: helper.isAvailableToThisAccount+ isAdministrator: helper.isAdministrator),]hasChecked = truediff --git a/Peel/Model/SelectionCarrier.swift b/Peel/Model/SelectionCarrier.swiftindex 4b8d624f..755da7dc 100644--- a/Peel/Model/SelectionCarrier.swift+++ b/Peel/Model/SelectionCarrier.swift@@ -109,20 +109,23 @@ final class SelectionCarrier {var removal = RemovalInProgress()var appsToQuit: [String] = []let pass = await QuitGuard.shared.run {- await CarriedSelection.pass(parts) { part in- // What a part moves is written down with the removal and the part, so a stop before the part is- // recorded leaves one removal in History, not two.- let recorded = RecordedRemoval(batch: removal.batch, part: part.removalPart)- guard let tool = tool(of: part),- let result = await RecordedRemoval.$current.withValue(recorded, operation: {- await tool.move(part, apps: apps)- })- else {- appsToQuit.append(tool(of: part)?.appToQuit(for: part) ?? part.title)- return nil+ // Every part shares one administrator's approval, for an account that isn't one.+ await PrivilegedHelper.withOneConsent {+ await CarriedSelection.pass(parts) { part in+ // What a part moves is written down with the removal and the part, so a stop before the part is+ // recorded leaves one removal in History, not two.+ let recorded = RecordedRemoval(batch: removal.batch, part: part.removalPart)+ guard let tool = tool(of: part),+ let result = await RecordedRemoval.$current.withValue(recorded, operation: {+ await tool.move(part, apps: apps)+ })+ else {+ appsToQuit.append(tool(of: part)?.appToQuit(for: part) ?? part.title)+ return nil+ }+ await history.record(result, part: part.removalPart, sizes: part.measuredSizes, in: &removal)+ return result}- await history.record(result, part: part.removalPart, sizes: part.measuredSizes, in: &removal)- return result}}history.finish(removal)diff --git a/Peel/Model/SelfUninstall.swift b/Peel/Model/SelfUninstall.swiftindex 189fbd3b..8f1225c9 100644--- a/Peel/Model/SelfUninstall.swift+++ b/Peel/Model/SelfUninstall.swift@@ -84,8 +84,8 @@ final class SelfUninstall {/// Whether Peel can't remove itself from this account: its helper is registered, and only an administrator may/// change it.- static func waitsForAnAdministrator(standing: PrivilegedHelper.Standing, status: PrivilegedHelper.Status) -> Bool {- standing == .notThisAccount && (status == .enabled || status == .requiresApproval)+ static func waitsForAnAdministrator(isAdministrator: Bool, status: PrivilegedHelper.Status) -> Bool {+ !isAdministrator && (status == .enabled || status == .requiresApproval)}static var onlyAnAdministrator: String {diff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swiftindex eba0eb60..1391d4db 100644--- a/Peel/PeelApp.swift+++ b/Peel/PeelApp.swift@@ -87,6 +87,7 @@ struct PeelApp: App {/// clicks on notifications to reach it. A view's task can run later than that. The storage tools are made here/// too, so the carrier of their selection reads the same libraries their pages show.init() {+ PrivilegedHelper.consentPrompt = String(localized: "This account isn’t an administrator, so Peel’s helper does this only with an administrator’s approval.")SettingsKey.showInMenuBarAsBefore()SettingsKey.keepSidebarChoicesAsBefore()let notifications = PeelNotifications()diff --git a/Peel/Views/FixedSentenceText.swift b/Peel/Views/FixedSentenceText.swiftindex 25251215..ad8cbc26 100644--- a/Peel/Views/FixedSentenceText.swift+++ b/Peel/Views/FixedSentenceText.swift@@ -22,6 +22,7 @@ extension FixedSentence {case .onlyGoneProgramsThere: "From that folder, Peel removes only what starts a program that is no longer there."case .helperOutOfDate: "Peel’s helper is out of date. Reinstall it in Settings."case .accountNotAllowed: "This account isn’t allowed to use Peel’s helper."+ case .notAuthorized: "An administrator didn’t allow this."case .tooManyItems: "Too many items in one request."case .noTrash: "There’s no Trash to move this to."case .pathTooLong: "The path is too long."diff --git a/Peel/Views/HelperRequiredBanner.swift b/Peel/Views/HelperRequiredBanner.swiftindex 000858e6..b34c4a70 100644--- a/Peel/Views/HelperRequiredBanner.swift+++ b/Peel/Views/HelperRequiredBanner.swift@@ -2,7 +2,7 @@ import PeelCoreimport SwiftUI/// Over a page that needs the helper for what it does. It says what that is, and which of the four things is in the-/// way, since "install it" is no use to somebody whose helper is installed and is not allowed to use it.+/// way, since "install it" is no use to somebody whose helper is installed, or who isn't an administrator.struct HelperRequiredBanner: View {@Environment(HelperModel.self) private var helper@Environment(\.openSettings) private var openSettings@@ -62,7 +62,7 @@ extension PrivilegedHelper.Standing {? "Peel’s helper was installed by another copy of Peel, and this copy can’t use it. Open the copy of Peel that installed it.": "Install Peel’s helper, which does this as an administrator in the system folders it serves."case .waitingForApproval: "Peel’s helper is waiting to be allowed in System Settings, under Login Items & Extensions."- case .notThisAccount: "Only an administrator can use Peel’s helper, so Peel can’t do this from this account."+ case .notThisAccount: "Only an administrator can install, allow, or repair Peel’s helper. Once it works, Peel asks for an administrator’s name and password for this."case .notAnswering: "Peel’s helper isn’t answering. Repair it in Settings."}}diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swiftindex 28f05582..ffb65df3 100644--- a/Peel/Views/Settings/SettingsView.swift+++ b/Peel/Views/Settings/SettingsView.swift@@ -186,7 +186,7 @@ private struct GeneralSettingsView: View {private var installCommand: String? { SettingsKey.commandLineInstallCommand(for: commandLine) }private static let place = CommandLineTool.place()private static let embeddedTool = Bundle.main.bundleURL.appending(path: "Contents/Helpers/peel")- private var isStandardAccount: Bool { !helper.isAvailableToThisAccount }+ private var isStandardAccount: Bool { !helper.isAdministrator }private static let blockAhead = SelfRemoval.blockAhead(of: Bundle.main.bundleURL)@AppStorage(SettingsKey.checksForAppUpdates) private var checksForAppUpdates = true@@ -673,7 +673,7 @@ extension GeneralSettingsView {}private var waitsForAnAdministrator: Bool {- SelfUninstall.waitsForAnAdministrator(standing: helper.standing, status: helper.status)+ SelfUninstall.waitsForAnAdministrator(isAdministrator: helper.isAdministrator, status: helper.status)}/// The cask Homebrew installed this copy of Peel from, found by the rule the Applications list follows.@@ -779,13 +779,14 @@ private struct HelperSettingsView: View {case .waitingForApproval:Text("Allow Peel in System Settings under Login Items & Extensions.")case .notThisAccount:- Text("Only an administrator can use the helper. Log in as an administrator to remove items that need one.")+ Text("Only an administrator can install, allow, or repair the helper. Once it works, Peel asks for an administrator’s name and password each time this account needs it.")case .notAnswering:// Several causes share this message: an older or newer helper, a signature that doesn't// match, or a helper that didn't start.Text("Peel’s helper isn’t answering. Repairing it installs the one this version of Peel works with.")case .ready:- nil+ helper.isAdministrator+ ? nil : Text("Peel asks for an administrator’s name and password each time this account needs the helper.")}}diff --git a/PeelHelper/HelperListenerDelegate.swift b/PeelHelper/HelperListenerDelegate.swiftindex 12024f53..0858613d 100644--- a/PeelHelper/HelperListenerDelegate.swift+++ b/PeelHelper/HelperListenerDelegate.swift@@ -10,9 +10,10 @@ final class HelperListenerDelegate: NSObject, NSXPCListenerDelegate {self.codeSigningRequirement = codeSigningRequirement}+ /// Takes Peel's connection from any account: each request is served only for an administrator, or with an+ /// administrator's approval (`HelperRequest.caller`).func listener(_ listener: NSXPCListener, shouldAcceptNewConnection connection: NSXPCConnection) -> Bool {- let isAdministrator = { UserAuthorization.isAdministrator(connection.effectiveUserIdentifier) }- guard lifetime.accept(isAdministrator) else { return false }+ lifetime.connectionOpened()// The listener checks the code only when it connects; with this, a message from any other code closes the// connection (`NSXPCConnection.h`), so a connection handed to another process is never served.@@ -31,8 +32,8 @@ final class HelperListenerDelegate: NSObject, NSXPCListenerDelegate {/// from sending anything else.private static func interface() -> NSXPCInterface {let interface = NSXPCInterface(with: (any PeelHelperProtocol).self)- let trash = #selector((any PeelHelperProtocol).moveItemsToTrash(version:atPaths:withReply:))- interface.setClasses(classes(NSArray.self, NSString.self), for: trash, argumentIndex: 1, ofReply: false)+ let trash = #selector((any PeelHelperProtocol).moveItemsToTrash(version:approval:atPaths:withReply:))+ interface.setClasses(classes(NSArray.self, NSString.self), for: trash, argumentIndex: 2, ofReply: false)for index in 0...1 {interface.setClasses(classes(NSDictionary.self, NSString.self),diff --git a/PeelHelper/HelperService.swift b/PeelHelper/HelperService.swiftindex a2666e10..f2d27e58 100644--- a/PeelHelper/HelperService.swift+++ b/PeelHelper/HelperService.swift@@ -10,17 +10,12 @@ final class HelperService: NSObject, PeelHelperProtocol {self.lifetime = lifetime}- /// The account behind the connection the message came on, and its home folder. Nil when that account is not- /// an administrator or its home folder cannot be found. It is asked for each message, so an account that stops- /// being an administrator is refused from its next request. It says whose connection it is, not which process- /// sent the message: `xpc_connection_create(3)` warns that a client can hand its connection to another process.- private static func caller() -> HelperRequest.Caller? {- guard- let user = NSXPCConnection.current()?.effectiveUserIdentifier,- UserAuthorization.isAdministrator(user),- let home = UserAuthorization.homeDirectory(of: user)- else { return nil }- return HelperRequest.Caller(user: user, homeDirectory: home)+ /// The account behind the connection the message came on, and its home folder, when it is an administrator or+ /// `approval` holds an administrator's approval now. It is asked for each message, so an account that stops being+ /// an administrator is refused from its next request. It says whose connection it is, not which process sent the+ /// message: `xpc_connection_create(3)` warns that a client can hand its connection to another process.+ private static func caller(approval: Data = Data()) -> Result<HelperRequest.Caller, HelperRefusal> {+ HelperRequest.caller(user: NSXPCConnection.current()?.effectiveUserIdentifier, approval: approval)}/// The `peel` tool of the app the helper runs from, found from the program the kernel says it runs.@@ -40,6 +35,7 @@ final class HelperService: NSObject, PeelHelperProtocol {func moveItemsToTrash(version: Int,+ approval: Data,atPaths paths: [String],withReply finish: @escaping @Sendable ([String: String], [String: String]) -> Void) {@@ -53,7 +49,9 @@ final class HelperService: NSObject, PeelHelperProtocol {}let caller: HelperRequest.Callerdo {- caller = try HelperRequest.admit(version: version, items: paths.count, caller: Self.caller).get()+ caller = try HelperRequest.admit(version: version, items: paths.count) {+ Self.caller(approval: approval)+ }.get()} catch {return refuse(error.rawValue)}@@ -86,6 +84,7 @@ final class HelperService: NSObject, PeelHelperProtocol {func restoreItem(version: Int,+ approval: Data,fromTrashPath trashPath: String,toPath destination: String,withReply finish: @escaping @Sendable (String?) -> Void@@ -95,7 +94,7 @@ final class HelperService: NSObject, PeelHelperProtocol {let caller: HelperRequest.Callerdo {let paths = [trashPath, destination]- caller = try HelperRequest.admit(version: version, paths: paths, caller: Self.caller).get()+ caller = try HelperRequest.admit(version: version, paths: paths) { Self.caller(approval: approval) }.get()} catch {return reply(error.rawValue)}@@ -134,7 +133,7 @@ final class HelperService: NSObject, PeelHelperProtocol {let reply = tracked(finish)let caller: HelperRequest.Callerdo {- caller = try HelperRequest.admit(version: version, caller: Self.caller).get()+ caller = try HelperRequest.admit(version: version) { Self.caller() }.get()} catch {return reply(error.rawValue)}@@ -150,13 +149,15 @@ final class HelperService: NSObject, PeelHelperProtocol {func runDaemonCommand(version: Int,+ approval: Data,command: String,label: String,withReply finish: @escaping @Sendable (String?) -> Void) {lifetime.requestStarted()let reply = tracked(finish)- if case .failure(let refusal) = HelperRequest.admit(version: version, caller: Self.caller) {+ let admitted = HelperRequest.admit(version: version) { Self.caller(approval: approval) }+ if case .failure(let refusal) = admitted {return reply(refusal.rawValue)}guard let command = DaemonCommand(rawValue: command), PrivilegedPathPolicy.allowsDaemon(label) else {diff --git a/PeelTests/HelperReasonTests.swift b/PeelTests/HelperReasonTests.swiftindex 815d317d..8546e7af 100644--- a/PeelTests/HelperReasonTests.swift+++ b/PeelTests/HelperReasonTests.swift@@ -10,7 +10,7 @@ struct HelperReasonTests {String(localized: standing.whyItCannotAct(registeredByAnotherCopy: anotherCopy))}- #expect(reason(.notThisAccount, false) == String(localized: "Only an administrator can use Peel’s helper, so Peel can’t do this from this account."))+ #expect(reason(.notThisAccount, false) == String(localized: "Only an administrator can install, allow, or repair Peel’s helper. Once it works, Peel asks for an administrator’s name and password for this."))#expect(reason(.notInstalled, false) == String(localized: "Install Peel’s helper, which does this as an administrator in the system folders it serves."))#expect(reason(.notInstalled, true) == String(localized: "Peel’s helper was installed by another copy of Peel, and this copy can’t use it. Open the copy of Peel that installed it."))#expect(reason(.waitingForApproval, false) == String(localized: "Peel’s helper is waiting to be allowed in System Settings, under Login Items & Extensions."))diff --git a/PeelTests/SelfUninstallTests.swift b/PeelTests/SelfUninstallTests.swiftindex 9486ef4c..528d6ec5 100644--- a/PeelTests/SelfUninstallTests.swift+++ b/PeelTests/SelfUninstallTests.swift@@ -46,9 +46,9 @@ struct SelfUninstallTests {@MainActorstruct SelfUninstallAccountTests {@Test func waitsForAnAdministratorOnlyWhileTheHelperIsRegistered() {- #expect(SelfUninstall.waitsForAnAdministrator(standing: .notThisAccount, status: .enabled))- #expect(SelfUninstall.waitsForAnAdministrator(standing: .notThisAccount, status: .requiresApproval))- #expect(!SelfUninstall.waitsForAnAdministrator(standing: .notThisAccount, status: .notRegistered))- #expect(!SelfUninstall.waitsForAnAdministrator(standing: .ready, status: .enabled))+ #expect(SelfUninstall.waitsForAnAdministrator(isAdministrator: false, status: .enabled))+ #expect(SelfUninstall.waitsForAnAdministrator(isAdministrator: false, status: .requiresApproval))+ #expect(!SelfUninstall.waitsForAnAdministrator(isAdministrator: false, status: .notRegistered))+ #expect(!SelfUninstall.waitsForAnAdministrator(isAdministrator: true, status: .enabled))}}diff --git a/SAFETY.md b/SAFETY.mdindex dbabe0b2..c29d2917 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -18,7 +18,8 @@ In short:else is shown with its reason and left to you.- Nothing moves from under a program of yours that is using it.- The few things History can't undo say so before you confirm them.-- The helper that runs as root does a few things only, for administrators only, and checks everything again itself.+- The helper that runs as root does a few things only, for an administrator or with an administrator's approval, and+ checks everything again itself.To report a way around any of this, see [SECURITY.md](SECURITY.md).@@ -644,11 +645,12 @@ to the Trash, putting them back, and starting, stopping, enabling, or disablingPeel is removed, it also moves its own ledger to the Trash. It is deliberately small: no shell, no arbitrary paths,and it fails closed.-- It answers administrators only, and only a copy of Peel signed by the same team with its Developer ID,- built so it can't be debugged, no older a build than the helper itself, that speaks the helper's own version.- All of it is checked when the app connects and again with each request, so an account that stops being an- administrator is refused from then on, and a message from any other program closes the connection. macOS starts- the helper only as the developer's own build of it, so other code put in its place never runs as root.+- It answers an administrator, and another account only with an administrator's approval for that action, which+ macOS asks for in its own window, once per action. It answers only a copy of Peel signed by the same team with its+ Developer ID, built so it can't be debugged, no older a build than the helper itself, that speaks the helper's own+ version. All of it is checked again with each request, so an account that stops being an administrator is refused+ from then on, and a message from any other program closes the connection. macOS starts the helper only as the+ developer's own build of it, so other code put in its place never runs as root.- It refuses the list above on its own, without asking the app, and asks it both ways: a folder that holdssomething on the list is refused like the thing itself.- It serves a fixed list of folders and refuses everything else: `/Applications`, for apps only; eight foldersdiff --git a/SECURITY.md b/SECURITY.mdindex 3859efb6..54b6b6d6 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -101,9 +101,10 @@ have, and anything that destroys data that cannot be recovered.Peel's identifier, signed with Developer ID by Peel's team, that cannot be debugged and is no oldera build than the helper itself, wherever that copy sits. That includes defeating thiscode-signing requirement on the XPC peer, or replaying or forging a connection.-- Any way to get the helper to act for an account that is not an administrator. Every account on the- Mac can reach its Mach service, by design; the helper answers administrators only, checked when a- connection opens and again with each message.+- Any way to get the helper to act for an account that is not an administrator without an+ administrator's approval. Every account on the Mac can reach its Mach service, by design; the helper+ answers an administrator, and another account only for a request that carries an administrator's+ approval in force for `system.privilege.admin`, checked again with each message.- Any way to get the helper to touch a path outside the locations `PrivilegedPathPolicy` allows:path traversal, `..` handling, symlink or hardlink following, mount tricks, firmlinks, or arace between the check and the file operation (TOCTOU).