Skip to content

Use win-updater.exe in update API impl - #177

Merged
infeo merged 2 commits into
developfrom
feature/win-updater-helper
Nov 17, 2026
Merged

infeo merged 2 commits into
developfrom
feature/win-updater-helper

Conversation

@infeo

@infeo infeo commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

This PR refactors the implementation of the update API. (see #164 )

The old implementation had a TOCTOU issue: The temporary script did not locked the installer files, but verification was done in this lib. An attacker could have swapped the installer after the verification.

The script approach is replaced by using a native executable to update, see also https://github.com/cryptomator/win-updater. If the exe is not present next to the binary running the app (and this lib), the update fails. The name of the update helper must be specified via the property cryptomator.integrationsWin.updateHelperName.

Use an external executable instead of script
@infeo infeo self-assigned this Nov 16, 2026
Copilot AI balanced review requested due to automatic review settings November 16, 2026 17:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Cancellation does not terminate the installer helper after readiness, allowing a cancelled update to install if the application exits within the helper’s 60-second wait window.

1 open issue
What changed in this PR

Delegates Windows in-place updates to win-updater, replacing the script-based flow to address the risk of installers being swapped after verification.

Changes:

  • Requires a configured native helper beside the application executable.
  • Waits for the helper’s READY signal before requesting application exit, with timeout and failure handling.
  • Replaces Java-side signature verification and its tests with helper-command and handshake tests, and documents deployment requirements.
File Description
src/​test/​java/​org/​cryptomator/​windows/​update/​InstallerUpdateMechanismTest.java Tests helper configuration, command arguments, readiness, and failures.
src/​test/​java/​org/​cryptomator/​windows/​update/​AuthenticodeIT.java Removes tests for the deleted Java signature verifier.
src/​main/​resources/​WinIntegrationsBundle.properties Removes the unused restarting message.
src/​main/​java/​org/​cryptomator/​windows/​update/​InstallerUpdateMechanism.java Launches the native helper and handles its readiness handshake.
src/​main/​java/​org/​cryptomator/​windows/​update/​Authenticode.java Removes Java-side Authenticode verification.
README.md Documents the helper requirement and configuration property.
CHANGELOG.md Records the updater refactor and security change.

Review effort: Balanced

public UpdateStep secondStep(Path workDir, Path assetPath, DownloadUpdateInfo updateInfo) {
return UpdateStep.of(Localization.get().getString("org.cryptomator.windows.update.installer.verifying"), () -> this.verify(workDir, assetPath));
// the updater verifies the installer before it reports to be ready, so this step covers starting it and the handshake
return UpdateStep.of(Localization.get().getString("org.cryptomator.windows.update.installer.verifying"), () -> this.startUpdater(workDir, assetPath, updateInfo.asset().digest()));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not implemented.

After download we wait for the "READY" signal. Once received, we return UpdateStep.EXIT, meaning "terminate and update now". Additionally, our UpdateStep impl is given by UpdateStepAdapter which cancels by interrupt, and we are interruptible during the wait for the READY signal.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Installer updates now require the updateHelperName setting. The mechanism starts the configured updater with installer, digest, signing, process, and work-directory details. It waits up to 60 seconds for a READY response and reports startup, handshake, and updater exit failures. The in-process Authenticode implementation and its integration tests were removed. The README and changelog document the updater requirement and the installer-swapping fix.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Merge Risk: Minimal · up to 62068

Installer updates now go through the separate win-updater executable, which must be configured and shipped next to the application. The library reports startup, handshake and exit failures. The claim that this closes the installer-swapping window relies on the external updater's behavior, which this review could not inspect, so that part is unconfirmed rather than a found defect. No merge-blocking issue is established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the update API implementation now uses the native win-updater.exe helper. The changeset replaces the batch-script install flow in InstallerUpdateMechanism with a call …
Description check Passed The description states the purpose of the refactor, which is to fix a TOCTOU issue in the old script-based update. It explains that the native win-updater executable replaces the script and that the u…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the update API implementation now uses the native win-updater.exe helper. The changeset replaces the batch-script install flow in InstallerUpdateMechanism with a call to a configured updater executable, so the title matches the primary change.

Full details: Description check

Explanation

The description states the purpose of the refactor, which is to fix a TOCTOU issue in the old script-based update. It explains that the native win-updater executable replaces the script and that the update fails if the executable is missing. It also names the required updateHelperName property, which matches the InstallerUpdateMechanism and README changes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da73ddcc-19bd-4908-8d2c-4954e2d3e05e
Commits

Reviewing files that changed from the base of the PR and between ccf0058 and 62068c0.

Files ignored due to path filters: 1

  • src/test/resources/org/cryptomator/windows/update/signed-integrations-x64.dll is excluded by !**/*.dll
Files selected for processing: 7

  • CHANGELOG.md
  • README.md
  • src/main/java/org/cryptomator/windows/update/Authenticode.java
  • src/main/java/org/cryptomator/windows/update/InstallerUpdateMechanism.java
  • src/main/resources/WinIntegrationsBundle.properties
  • src/test/java/org/cryptomator/windows/update/AuthenticodeIT.java
  • src/test/java/org/cryptomator/windows/update/InstallerUpdateMechanismTest.java
Files with no reviewable changes: 2

  • src/main/java/org/cryptomator/windows/update/Authenticode.java
  • src/test/java/org/cryptomator/windows/update/AuthenticodeIT.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@infeo infeo added this to the next milestone Nov 17, 2026
@infeo
infeo merged commit 76ba317 into develop Nov 17, 2026
13 checks passed
@infeo
infeo deleted the feature/win-updater-helper branch November 17, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants