1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2026-07-06 04:58:01 -05:00

macOS: honor the CheckFilesystem repair flag (#1791)

CoreMacOSX::CheckFilesystem() ignored both its mountedVolume and repair
arguments and always just launched Disk Utility.app, so the "Check
Filesystem" and "Repair Filesystem" menu items behaved identically and
neither acted on the mounted volume. On Linux/BSD the same operation runs
fsck and honors the flag (passing -n only when repair is false).

Run diskutil on the VeraCrypt virtual device, choosing verifyVolume or
repairVolume per the flag (diskutil unmounts the inner filesystem itself
as needed). The Core layer has no GUI, so the result is shown in a
Terminal window via a temporary .command script; it falls back to
launching Disk Utility.app when no virtual device is available.

Run the macOS check in the unprivileged application process. VeraCrypt does
not need to create or launch the helper script from the elevated core
service: diskutil operates on the mounted virtual device and macOS handles
any device authorization requirements. Once a device-hosted mount has
started the elevated core service, every later service request is routed to
that root process. There it would create the helper script as root (0700)
and open a Terminal in the GUI session that the user could neither read nor
execute. CoreServiceProxy::CheckFilesystem now invokes the core
implementation directly on macOS instead of sending a service request, so
the script is always owned by the GUI user.

The device path is strictly validated as /dev/[r]diskN[sM] before being
single-quoted into the command. The helper script is created securely in
the per-user temp directory via mkstemps() (atomic O_EXCL/0600, fchmod
0700 by descriptor, close() checked for deferred write errors, unlinked on
any failure) rather than at a predictable, enumerable path in the
world-writable /tmp, guarding against a symlink/race on the executed
script. A trap removes the script on exit even if the window is closed
early, and it is also unlinked if launching Terminal fails. The script
captures $? so diskutil's result, including failures, is shown before the
script exits.

Replace the macOS pre-check message (which still told the user Disk
Utility would open and to pick Verify/Repair manually) with check- and
repair-specific text describing the new automatic diskutil flow.

Seed the two new strings into all translation files with the English
text so the XML key-completeness check passes; localization can follow.

Co-authored-by: Damian Rickard <damian@rickard.us>
This commit is contained in:
damianrickard
2026-06-22 01:05:45 -04:00
committed by GitHub
parent 94fabdd0b7
commit 355b61f41a
46 changed files with 242 additions and 1 deletions
+2
View File
@@ -1498,6 +1498,8 @@
<entry lang="fr" key="LINUX_REMOUNT_BECAUSEOF_SETTING">Notez que tous les volumes actuellement montés doivent être démontés puis remontés avant que ce paramètre ne puisse être appliqué.</entry>
<entry lang="fr" key="LINUX_UNKNOWN_EXC_OCCURRED">Une exception inconnue s'est produite.</entry>
<entry lang="fr" key="LINUX_FIRST_AID">L'utilitaire de disque sera lancé après avoir appuyé sur 'OK'.\n\nVeuillez sélectionner votre volume dans la fenêtre de l'utilitaire de disque et cliquer sur le bouton 'Vérifier le disque' ou 'Réparer le disque' dans l'onglet 'Premiers secours'.</entry>
<entry lang="en" key="MACOSX_CHECK_FILESYS">A Terminal window will open after you press 'OK' and check the file system on the selected VeraCrypt volume using 'diskutil'. The result will be shown in that window.\n\nIf the check cannot be started, Disk Utility will be launched instead.</entry>
<entry lang="en" key="MACOSX_REPAIR_FILESYS">A Terminal window will open after you press 'OK' and attempt to repair the file system on the selected VeraCrypt volume using 'diskutil'. The result will be shown in that window.\n\nIf the repair cannot be started, Disk Utility will be launched instead.</entry>
<entry lang="fr" key="LINUX_MOUNT_ALL_DEV">Tout Monter</entry>
<entry lang="fr" key="LINUX_ERROR_LOADING_CONFIG">Erreur lors du chargement des fichiers de configuration situés dans </entry>
<entry lang="fr" key="LINUX_SELECT_FREE_SLOT">Veuillez sélectionner un emplacement de lecteur libre dans la liste.</entry>