Skip to content

feat(ENG-4705): install plugin updates in the background, apply on restart (staging) - #270

Merged
vgoat21 merged 1 commit into
stagingfrom
joshuavillaltaesp/eng-4705-plugins-ghidra-download-updates-staging
Nov 18, 2026
Merged

vgoat21 merged 1 commit into
stagingfrom
joshuavillaltaesp/eng-4705-plugins-ghidra-download-updates-staging

Conversation

@vgoat21

@vgoat21 vgoat21 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Linear: ENG-4705 (part of ENG-4528)

What changed

The update check added in v1.2.0 now installs updates instead of only opening the download in the browser.

  • Download: when a newer release has a build for the running Ghidra version, UpdateInstaller downloads it in the background. It checks the zip against the SHA-256 digest GitHub publishes for each release asset (digest in the releases API), so the release workflow doesn't need a separate SHA256SUMS file. It then unpacks the zip into <user settings>/reai-plugin-update/. That folder is outside Extensions/, so Ghidra doesn't load the update as a second copy.
  • Install on exit: a JVM shutdown hook starts ExtensionSwapper in a separate JVM, running from a copy of the plugin jar. The swapper waits for the Ghidra process to exit, then moves the installed plugin-ghidra folder aside and moves the staged one in. If the move fails, it restores the old folder. It retries the moves for a short while to give Windows time to release file locks.
    • This is needed because Ghidra keeps the extension jars open while it runs, and Windows locks them.
    • The swapper uses only JDK classes.
  • Prompt: "RevEng.AI plugin vX has been downloaded… restart Ghidra to start using it", with OK or Skip this version. Skipping deletes the downloaded update. A "Update ready (vX) - restart Ghidra" menu item and a status-bar message are also shown.
  • Next startup: the result of the swap (update.log) is written to Ghidra's log and the staging folder is removed. If a staged update is still newer than the running version, for example because the swap failed while another Ghidra instance had the jars open, it is kept and installed on the next exit. No new download is needed, and this works offline.
  • Fallback: the existing prompt (Download / Later / Skip) still appears when:
    • the new Install updates automatically option is off,
    • the extension isn't in the user's own Extensions/ folder (for example, it's in the Ghidra install folder),
    • the asset has no digest, or
    • the download fails.
  • An extension the user has uninstalled is never re-installed: the swapper skips it if extension.properties has been renamed away.
  • README: new "Updating" section.

Testing

  • ./gradlew test: all 68 test classes pass. New tests:
    • UpdateInstallerTest: extraction, rejecting zip entries that would land outside the extension folder, rejecting a zip with no plugin jar, checksum verification, reading the staged version.
    • ExtensionSwapperTest: install, skipped update, uninstalled extension, rollback when the staged folder is missing.
    • UpdateCheckerTest: parsing the digest.
  • ./gradlew buildExtension builds against Ghidra 12.1.2.
  • End-to-end on macOS with the real v1.2.0 ghidra_12.1.2_plugin-ghidra.zip:
    • The checksum matched GitHub's digest.
    • The zip extracted correctly, including its duplicate entries.
    • ExtensionSwapper ran in its own JVM with only its class on the classpath, waited for a stand-in "Ghidra" process to exit, swapped the folder, and cleaned up the staging folder.
  • Not yet tested: the full flow inside a running Ghidra (the dialog and the shutdown hook) and on Windows. A local build reports version unknown and skips the update check, so this needs a released build, or a build with reai_ghidra_plugin_version.txt set to an older tag, installed in Extensions/.

… them on restart

When a newer release is found, download the build for the running Ghidra
version, verify it against GitHub's SHA-256 asset digest and unpack it into
reai-plugin-update/ in the user settings folder. A shutdown hook starts
ExtensionSwapper in its own JVM, which waits for Ghidra to exit and swaps the
staged folder over the installed extension, restoring the old one on failure.

Adds an 'Install updates automatically' option; with it off, or when the
extension is not in the user's Extensions folder, the existing download
prompt is shown.
@vgoat21
vgoat21 requested a review from a team as a code owner November 18, 2026 12:15
@vgoat21
vgoat21 merged commit 4534a05 into staging Nov 18, 2026
28 checks passed
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