Really enable Ghidra's Developer plugins in both tools

A bare <PACKAGE NAME="Developer" /> only adds the package's RELEASED
plugins, so half of them (the STABLE ones) were missing and Configure
showed Developer unticked. The project window wasn't configured at all.

- CodeBrowser: insert ghidra/codebrowser-developer.xml, which lists the
  STABLE plugins explicitly, into the default CodeBrowser.tool in
  Public_Release.jar.
- Project window: it has no default config to patch, so ship
  ghidra/FrontEndTool.xml in the user settings with its three
  Developer plugins.
- Pre-creating the settings dir makes Ghidra show its user agreement;
  ghidra/preferences sets USER_AGREEMENT=ACCEPT, the value Ghidra
  writes by itself on a fresh start.

Verified by closing Ghidra cleanly: it rewrites FrontEndTool.xml from
the loaded plugins and kept all three Developer plugins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 12:58:19 +01:00
co-authored by Claude Opus 5.5
parent 705f4a52a6
commit 51573544a4
5 changed files with 62 additions and 6 deletions
+22 -5
View File
@@ -56,21 +56,38 @@ ENV GHIDRA_INSTALL_DIR=/opt/ghidra
# CodeBrowser. Ghidra copies its default tools into the user's settings on
# first start, and settings are reset on every container start, so the
# default CodeBrowser.tool inside the jar is patched instead of user config.
# The build fails if the line could not be inserted.
# A bare <PACKAGE NAME="Developer" /> only adds the package's RELEASED
# plugins; the snippet also lists the STABLE ones. The build fails if the
# snippet could not be inserted.
COPY ghidra/codebrowser-developer.xml /tmp/codebrowser-developer.xml
RUN set -e; cd /tmp \
&& jar_file=/opt/ghidra/Ghidra/Configurations/Public_Release/lib/Public_Release.jar \
&& unzip -q "$jar_file" defaultTools/CodeBrowser.tool \
&& sed -i '0,/<ROOT_NODE/s//<PACKAGE NAME="Developer" \/>\n <ROOT_NODE/' defaultTools/CodeBrowser.tool \
&& grep -q '<PACKAGE NAME="Developer" />' defaultTools/CodeBrowser.tool \
&& awk 'FNR==NR { snip = snip $0 "\n"; next } !done && /<ROOT_NODE/ { printf "%s", snip; done = 1 } { print }' \
/tmp/codebrowser-developer.xml defaultTools/CodeBrowser.tool > /tmp/CodeBrowser.tool \
&& mv /tmp/CodeBrowser.tool defaultTools/CodeBrowser.tool \
&& grep -q 'FidDebugPlugin' defaultTools/CodeBrowser.tool \
&& jar uf "$jar_file" defaultTools/CodeBrowser.tool \
&& rm -r /tmp/defaultTools
&& rm -r /tmp/defaultTools /tmp/codebrowser-developer.xml
# Ubuntu 24.04 ships a default "ubuntu" user on UID 1000; replace it.
RUN if id ubuntu >/dev/null 2>&1; then userdel -r ubuntu; fi \
&& groupadd -g "${USER_GID}" "${USER_NAME}" \
&& useradd -m -u "${USER_UID}" -g "${USER_GID}" -s /bin/bash "${USER_NAME}" \
&& install -d -o "${USER_UID}" -g "${USER_GID}" /workspace \
&& ln -s /workspace "/home/${USER_NAME}/workspace"
&& ln -s /workspace "/home/${USER_NAME}/workspace" \
&& install -d -o "${USER_UID}" -g "${USER_GID}" \
"/home/${USER_NAME}/.config" \
"/home/${USER_NAME}/.config/ghidra" \
"/home/${USER_NAME}/.config/ghidra/ghidra_${GHIDRA_VERSION}_PUBLIC"
# Ghidra's project window has no default config to patch; it builds one in
# code and saves it on exit. So a starting FrontEndTool.xml with the Developer
# plugins is put in the user settings. Pre-creating the settings dir makes
# Ghidra ask for its user agreement, which it otherwise accepts by itself on
# a fresh start, so preferences carries the same USER_AGREEMENT=ACCEPT.
COPY --chown=${USER_UID}:${USER_GID} ghidra/FrontEndTool.xml ghidra/preferences \
/home/${USER_NAME}/.config/ghidra/ghidra_${GHIDRA_VERSION}_PUBLIC/
COPY --chmod=755 launch-apps.sh /usr/local/bin/launch-apps