Skip to content

Multi-backend plugin: shared core, IDA and Binary Ninja frontends - #17

Merged
danielplohmann merged 54 commits into
familiary:mainfrom
r0ny123:multi-backend
Sep 28, 2026
Merged

danielplohmann merged 54 commits into
familiary:mainfrom
r0ny123:multi-backend

Conversation

@r0ny123

@r0ny123 r0ny123 commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

#15 has merged into main. This branch is based on f3003de; the only later commit on main, c3ff5ab, adds CODEOWNERS and touches nothing here, so the diff is this PR's own changes.

This started as a draft so we could go through it together. It follows the plan in #16: one repo, one shared core, and a separate frontend for each disassembler. IDA keeps working the same way, and Binary Ninja is now supported.

Layout

mcrit_plugin/
  core/      MCRIT client, SMDA conversion, settings, no GUI imports
  ui_qt/     the Qt widgets, shared by IDA and Binja
  ida/       IdaBackend, plugin entry, ida-plugin.json
  binja/     BinjaBackend, SMDA interface over BinaryView, sidebar
  headless/  SMDA-only backend (no disassembler)
scripts/{ida,binja,common}
tests/{core,ui_qt,ida,binja}

Everything specific to a disassembler goes through core/Backend.py. The widgets only talk to self.cc.backend, so a Ghidra backend just has to implement that one interface. A test scans every core module with ast for Qt, Binary Ninja and IDA imports at any nesting level, so none of them can creep back into core.

IDA

  • Same features and settings keys as before.
  • ida-plugin.json now lives at mcrit_plugin/ida/. The packager puts it at the zip root, so HCLI installs work the same.
  • The IDA GUI integration test no longer crashes IDA on exit: it processes queued Qt deletions before qexit(), so IDA no longer aborts on macOS. This is a test-harness fix; the plugin itself was not affected.
  • Form lifecycle is tidier: plugmod_t.__del__ releases the form and its hooks, and Show() now passes WOPN_* flags instead of WCLS_*.
  • Pseudocode cursor tracking now uses get_widget_vdui(...).cfunc.entry_ea and no longer decompiles on every cursor move.

Binary Ninja

  • Installable through the extension manager: plugin.json and requirements.txt are at the repo root, and the minimum build is 10601 (6.0 stable).
  • SMDA reports come from Binja's own analysis. BinjaSmdaInterface feeds BinaryView into SMDA's exporter, the same way IDA's analysis is exported.
  • The UI is a sidebar (PerViewTypeSidebarContext, which is what the built-in Tags/Strings sidebars use), plus actions under Plugins > MCRIT.
  • Settings go in the Binja settings UI under mcrit.*. The API token is moved to the system keychain where one is available (otherwise it stays in Settings), and there's a "Clear Stored API Token" action to remove it.
  • Report export runs in a BackgroundTaskThread with progress, and a bulk label import is one undoable_transaction, so a single undo reverts it.
  • The CFG graph uses a native FlowGraph with true/false edge colours.
  • On close it offers to upload renamed functions, same as IDA.

Exporter agreement

scripts/common/compare_smda_reports.py diffs reports of the same binary exported by different tools. On a small PE test binary:

identical PicHash
IDA vs Binja 87/89 (97.8%)
IDA vs SMDA-native 76/83 (91.6%)
Binja vs SMDA-native 77/84 (91.7%)

The 2 IDA/Binja misses come from IDA inlining a shared function chunk into both callers, while Binja keeps it as its own tail-called function. So I'd keep the tool's own analysis as the default and not switch to SMDA-native.

Tests / CI

  • New headless-integration job in pytest.yml. It starts mongo and MCRIT 1.12.0, builds two fixture variants, and runs convert → upload → match → label import with HeadlessBackend. It needs no licence, so it runs on forks too.
  • IDA IDALib and GUI integration tests are kept, with "smoke" renamed to "integration".
  • New Binja GUI integration test (scripts/binja/run_gui_integration.py). It runs the full workflow in a throwaway BN_USER_DIRECTORY. It needs a licence, so for now it's local only.
  • Local results at the current head, against MCRIT 1.12.0 and SMDA 4.9.0: ruff clean, 214 pytest passed, the IDA 9.3 GUI test (144 checks) and the IDALib test pass, and the Binary Ninja 6.0 GUI test (166 checks) and the headless test pass. The IDA plugin releases as 2.0.0, see RELEASING.md for why.
  • The core commit is stamped into mcrit_plugin/core/revision.py: export-subst covers GitHub archives, the IDA packager covers the zip, and checkouts fall back to git. It's shown in the start message, so bug reports tell us which core a user is on.

Releases

  • IDA: push an ida-v* tag. ida-release.yml is the tag-driven workflow from Release on a tag from the changelog, with the checks that were memory before #15 (guard, changelog section as notes, tag must be on main and CI green), with the new script paths, ZIP-only hcli lint, and the release never marked latest. The guard reads the versions from mcrit_plugin/ida/, and its tests are in tests/ida/. The changelog check covers mcrit_plugin/{core,ui_qt,ida,binja}, mcrit_plugin/__init__.py, icons and the root plugin.json, __init__.py and requirements.txt. RELEASING.md covers both plugins, and CHANGELOG.md records this PR in its [2.0.0] section.
  • Binja: binja-release.yml, started by hand (Actions > Binary Ninja release, or gh workflow run binja-release.yml -f dry-run=true). It runs the checks read-only on main, then hands off to Vector35/plugin_actions (same action as Vector35's sample plugin, pinned to v1.1.0). That bumps plugin.json, commits it as github-actions[bot], tags the bare version and publishes the latest release, which is what extensions.binary.ninja reads. The release job bails if main moved after the checks ran.
  • I ran Vector35's release script locally against this branch with the upstream tags: blank version gives 1.0.1, and only the version line in plugin.json changes. One gotcha: the old IDA tags v1.1.4, v1.1.5 and v1.1.7–v1.1.10 block those version numbers for Binja, the action refuses them before committing anything.

CI layout

Workflows have to sit directly in .github/workflows/, so they're grouped by name:

IDA Binary Ninja
package check ida-package.yml (metadata sync, ZIP build, hcli lint) binja-package.yml (plugin.json vs requirements.txt/README, source archive check, dry run of Vector35/plugin_actions)
licensed tests ida-tests.yml not yet, no Binja headless licence in CI
release ida-release.yml binja-release.yml
release scripts .github/workflows/scripts/ida/release_guard.py done by plugin_actions

Shared: pytest.yml (pytest + headless MCRIT), ruff.yml (ruff + settings sync), changelog.yml, and offline-dependencies.yml, which both release workflows call.

  • The IDA and Binja workflows filter on paths: a Binja-only change doesn't start IDA jobs and vice versa. Shared code (core, ui_qt, icons, common scripts/tests, README, LICENSE, pyproject, .gitattributes) runs both. pytest/ruff/changelog always run. Skipped workflows report no status, so these can't be required checks; the IDA workflow's final "Licensed IDA result" job exists so that a skipped licensed job shows up as a warning with its reason instead of nothing. main has no required checks today.
  • Found while doing this: the offline bundles listened for release: published, which a release made with GITHUB_TOKEN never triggers, so 1.1.7–1.1.10 have no wheelhouse. Both release workflows now call offline-dependencies.yml directly, and it can still be run by hand for an old tag.
  • binja-release.yml now also checks CI passed on the released commit, same as the IDA one.
  • Comments are trimmed to the ones that record a contract or invariant. Comments carried over unchanged in moved files are left as they were.

Review pass

I went over the whole diff once more after the CI reorganisation and fixed what came up:

  • Binja: SecretsProvider[name] raises instead of returning None, so the no-keychain fallback never ran and "Clear Stored API Token" could throw; clearing now also resets the Settings copy. run_on_ui_thread re-raises exceptions from the main-thread callback, background results are dropped once the sidebar widget is gone (tab closed mid-export), and the sub_ filter in the exporter is anchored like the one in the backend. Settings are registered from the declared defaults, so config_override.json can't become a registered default. The family/sample download now runs in the background task instead of on the UI thread, a second Convert click while one is running is ignored (the fifth pass makes it say so), and the upload-on-close patches names into the existing report instead of re-disassembling the file. docs/, scripts/ and tests/ are export-ignored so the extension-manager install doesn't put those names on sys.path.
  • IDA: mutation() now creates an undo point, so a label import is one undo step like in Binja. The form is owned by the plugmod instead of a module global (PLUGIN_MULTI), a falsy Show() is treated as failure, execute_sync callbacks return an int, ask_yn/ask_file take the prompt as their format (see the fourth pass), and the legacy idaapi imports are replaced by ida_kernwin/ida_nalt/ida_graph/ida_undo.
  • Shared: the headless backend reports an address without a function as non-default like the GUI backends do (the fifth pass also makes an unnamed function default there), and boolean settings go through boolean coercion, so a string "false" is false.
  • CI: the offline-bundle steps activated the venv with .\venv\Scripts\activate, which under pwsh runs activate.bat in a child shell and activates nothing, so the wheelhouse was the runner's global site-packages. They call the venv's python.exe now; the matrix no longer fails fast. The release gates only accept a push run on the release branch as proof CI passed, and the IDA tag-on-main check goes through the compare API so it works without persisted credentials. The MCRIT service venv is Python 3.12 everywhere.
  • Docs: docs/development.md, README.md, RELEASING.md and AGENTS.md are checked line by line against the tree (paths, commands, triggers, versions); duplicated text now points at one place. plugin.json matches the sample plugin template field for field, and binaryninjaui is imported before PySide6 as the plugin docs require.

Second pass: manual testing and the moved code

Manual testing in Binary Ninja against a local MCRIT 1.9.0, plus a review of the code that was moved into the new layout but never re-reviewed (ui_qt, McritInterface), turned up these. Several are regressions that also affect IDA on current SMDA.

  • With SMDA 4.8, SmdaReport.getFunctions() caches its result. The plugin reused one outline report for every function query and only swapped xcfg, so the first query worked and every later one silently re-queried the first function. A fresh outline is built per query now.
  • Navigation from Binja's Symbols pane never reached the sidebar (notifyOffsetChanged isn't called for it); the plugin now also listens on UIContextNotification.OnAddressChange.
  • Sample Match Summary was never populated after fetching a result, and its PicHash and MinHash columns were swapped.
  • Function/Block Scope never loaded the sample cache again (checked is None on a {}), so SHA256 columns read "unknown" whenever the sample list could not be fetched at Convert.
  • Renaming a function from the name table wasn't undoable; Block Scope queried blocks under the size threshold and then discarded them; the Function Overview kept the first result's score range; label fetches re-downloaded everything each time; updateServerInfo touched a widget from a worker thread.
  • Every MCRIT failure was reported as "error on connection" with the traceback discarded. Failures now distinguish timeout / unreachable / rejected / unexpected, and an unexpected failure logs its traceback. SMDA backend selection could pick arm/mips/ppc, which don't exist in SMDA.
  • Colors: the Binja sidebar takes its tints from the active theme (getThemeColor) instead of the fixed IDA palette; IDA is unchanged.
  • API currency, checked against the installed IDA 9.4 and Binja 6.0 sources and the official docs: ida_funcs.get_func is deprecated in 9.4, so get_func_start is used when present; demangle_generic is deprecated since Binja 5.4, replaced by demangle_any. Everything else the plugin calls is current. Two things left as they are: QCheckBox.stateChanged is deprecated from Qt 6.9 but the Qt5 path still needs it, and ida-settings tries PyQt5 before PySide6, which makes IDA 9.4 show its shim prompt once (README says to answer No).

Both GUI integration tests now exercise every control on every tab with an assertion on its effect: at that point 166 checks in Binja, 147 in IDA (9.3 and 9.4). The fifth-pass runs used autonomous mode (-A), which has no disassembly view, so the three checks that need one (the disassembly cursor and two jumpto checks) do not run and IDA reports 144; --ui-session runs them. The IDA runner also copies the input to a fresh directory and pre-seeds idapython.cfg, so no modal dialog can block a run.

Third pass: rebased onto main

main gained three merges after this PR opened, and the stack (#15, then this branch) is rebased onto them:

  • cb19ded (idapyswitch picking the unversioned libpython3.so) landed at the moved location in ida-tests.yml.
  • The 1.1.10 release is reconciled: mcrit_plugin/ida/ida-plugin.json and config.py say 1.1.10, CHANGELOG.md has its [1.1.10] section, and its regression test moved to tests/core/test_smda_report_outline.py (now tests/ui_qt/), targeting McritSession, which already carried the same fix.
  • The licensed IDA job used to report skipped on pull requests from a fork, which reads as neither passing nor failing, and every pull request since 2026-08-12 came from a fork. The workflow now has a preflight job and an always-run Licensed IDA result check that names the reason (fork pull request, or missing licence secrets) when the licensed job could not run. It warns rather than fails, since a fork cannot obtain the secrets; a real failure of the licensed job stays red on that job. Dispatching the workflow on a branch of this repository gives the signal.

Fourth pass

A review of the whole branch against the Hex-Rays and Vector 35 documentation, three commits:

  • IDA dialogs. ask_file and ask_yn take the prompt as their printf format (ida_kernwin), and IDAPython's wrappers drop C varargs, so the "%s", prompt form from the first pass left IDA a bare %s with nothing to fill it. The prompt is the format again, with % escaped.
  • Reopening the form. Closing the form destroys its widgets but kept the McritSession, so Ctrl-F4 rebuilt empty widgets over the old reports. Reopening now builds a new form, as on main.
  • ida-settings. The fallback to get_current_plugin_setting() could never succeed (it resolves the same name from ida-plugin.json and repeats the lookup), and its PluginNotInstalledError could escape McritConfig. A plugin that is not installed reads the defaults.
  • Core. Tracebacks are logged only for unexpected errors, so an unreachable server with live query on doesn't log one per cursor move. The unused IDA 6.x import workaround in McritInterface is gone (Fix label import, scope queries and settings that shipped wrong in 1.1.10 #23 removes the rest), pylev is byte-identical to main again, and the no-GUI test also catches relative and package-level imports of ui_qt, ida and binja.
  • Docs and CI. The Changelog check covers mcrit_plugin/__init__.py and the root plugin.json, __init__.py and requirements.txt. RELEASING.md lists the versions the Binja release really refuses (1.1.10 yes, 1.4.5 no) and says only IDA notes come from CHANGELOG.md. The changelog records the upload-on-close change for IDA, boolean override values, SMDA backend selection and 1.1.10's missing bundles. RELEASING.md, the changelog links, ida-plugin.json and README's DeepWiki badge name familiary/mcrit-plugin.

The GUI tests were re-run for the fifth pass; the results are under Tests / CI.

Fifth pass: since 87afe6d

Review rounds against the Hex-Rays and Vector 35 documentation, the MCRIT 1.12.0 and MCRITweb sources, and runs of every integration test turned up bugs of two kinds. Those in code this PR adds or changes are fixed here, in three commits from 87afe6d. Those that shipped in 1.1.10 are fixed in #23, stacked on this PR, to merge right after it and before ida-v2.0.0 is tagged.

  • Fixed here: a rejected upload or job query showed "unexpected TypeError"; on Binary Ninja a double-clicked Overview row, or Query Current Function before the first cursor move, queried the wrong function, and a file split into two tabs routed actions to the first tab's sidebar; the headless backend treated SMDA's empty names as custom; the activity line, Binja's score range and the revision lookup had small regressions, and a click during an export did nothing silently.
  • Integration tests: they picked functions MCRIT will not MinHash and needed a server that already had labels; the Binary Ninja test cleared the developer's real keychain token; the IDA runner reopened an earlier run's database, could pass on an old log line, restored ida-config.json wrongly after hcli, and could hang for hours on a dead worker. All fixed, and CI runs against MCRIT 1.12.0.
  • Layout and docs: the frontend unit tests moved to tests/ida and tests/ui_qt. ida-plugin.json and README's DeepWiki badge name https://github.com/familiary/mcrit-plugin, where the repository now lives. RELEASING.md notes the ruleset on main and the HCLI ten-release window. The changelog's Changed list for 2.0.0 leads with the install change that makes it major.

Sixth pass: since a60ca63

One commit, 7aa4f95, for the review of the fourth and fifth passes:

  • ask_yn and ask_file get the prompt unchanged. IDAPython fixes their format to "%s" (the (const char *format, ...) typemap in its tools/deploy/header.i.in), so the escaping showed %%.
  • CI and docs/development.md pin SMDA 4.9.0. The IDA 9.3 GUI, IDALib, Binary Ninja GUI and headless tests pass locally on 4.9.0; the licensed CI job still has to run on it before the tag.
  • README notes that Python 3.10 resolves to SMDA 4.3.10, the last release for it.
  • The changelog check counts mcrit_plugin/headless/, and the changelog no longer says SMDA picks a backend for other non-x86 architectures.

Two nits are left as they are:

  • Split pane in _widget_for_view: a pane whose frame no widget has seen still falls back to the first tab's widget, as before this PR. Routing it to its own tab needs a lookup from view frame to tab, and a split-pane GUI test to prove it. It is listed under follow-ups.
  • Keychain override in the Binja GUI test: SecretsProvider.get catches the KeyError for an unknown name and returns None (binaryninja/secretsprovider.py in Binary Ninja 6.0). The GUI test passes on 6.0 and leaves the keychain without MCRIT items.

Merge order with SMDA

The Binary Ninja exporter moves upstream (danielplohmann/smda#356). The plugin-side switch to smda.binja is #22, not this PR, because it needs an SMDA release that does not exist yet. The order is:

  1. refactor: move the export engine out of smda.ida danielplohmann/smda#360 (export engine out of smda.ida), ci: accept binja as a PR title scope danielplohmann/smda#358 (binja scope), feat(binja): add Binary Ninja exporter as smda.binja danielplohmann/smda#357 (smda.binja) merge, in that order. Done 2026-09-28.
  2. SMDA 4.9.0 is released with them. Done; CI pins it from 7aa4f95.
  3. Multi-backend plugin: shared core, IDA and Binary Ninja frontends #17, then Fix label import, scope queries and settings that shipped wrong in 1.1.10 #23 (the 1.1.10 fixes, stacked on this PR), merge. This does not wait for steps 1 and 2.
  4. Export Binary Ninja reports through smda.binja #22 (stacked on Fix label import, scope queries and settings that shipped wrong in 1.1.10 #23) drops mcrit_plugin/binja/BinjaSmdaInterface.py, imports smda.binja and raises the Binary Ninja requirement to smda>=4.9.0.

Until #22 (step 4), the plugin keeps its own copy of the exporter, so the Binary Ninja plugin installs against SMDA 4.8.0.

Notes from review

Review up to d308a39 is complete: six findings across four batches, none release-blocking. The fourth and fifth passes are new since then. 1, 4, 5 and 6 are fixed in code (label cache retried after failure, nested mutation() guard on Binja, view contract in the interface docstring, IDA export behind a wait box with a warning on failure); 2 and 3 are behaviour changes kept and described below.

  • Cursor outside a code view. updateCurrentFunction now returns what get_current_function finds, and IdaBackend finds nothing in Hex View, Strings or Imports. The refresh hook returns early there instead of re-checking the unchanged function; Function Scope keeps showing the last function either way. The one visible difference is with live tracking off: a cursor move in such a view no longer clears the table and prints "deactivated" again. Incidental to the extraction, and kept.
  • SampleInfoWidget connects only selectionChanged; clicking an already selected row no longer re-populates the family table, which only depends on that row.
  • Label cache. Ids are recorded as fetched only after a successful label query, so a timeout does not leave the label column empty until Fetch Labels is pressed.
  • Background work is Binja-only. The SMDA export calls the IDA API throughout, and IDA allows that only on its main thread, so IdaBackend.run_background keeps the work synchronous. It now runs behind a wait box, and a failed export logs the traceback and shows the same warning dialog as on Binja instead of raising out of the button handler. §8.2 of Transforming the plugin into a multi-backend structure #16 should read as Binja for the off-thread part.

Decided in review

  • Binja network work on the UI thread: upload, Function/Block Scope queries and fetching a matching result stay on the UI thread, as in IDA; moving them off it is a follow-up.
  • First Binja version: 1.0.1. main's ruleset gets a bypass for GitHub Actions before the first run.

To do at the release

Decided in #16

Tags are ida-v*, with another IDA release as the fix if Binja releases push one out of HCLI's ten-release window (now in RELEASING.md); compare_smda_reports.py --min-agreement stays advisory, not a gate; Ghidra, address translation and splitting out view models are deferred.

Follow-ups

  • Move Binja's upload, scope queries and result fetch off the UI thread.
  • Route a split pane's sidebar actions to its own tab.
  • After the first Binja release, open an issue on Vector35/community-plugins so it gets listed.
  • Align the vendored McritClient with MCRIT 1.12's (timeouts, job selectors, and the sample_group_only arguments it has that MCRIT's does not).

Refs #16

@danielplohmann

Copy link
Copy Markdown
Collaborator

Two things landed on main today that this branch will want to pick up.

1. Please cherry-pick cb19ded — it affects this PR directly

mcrit_plugin's ida-tests.yml here still has the old line at .github/workflows/ida-tests.yml:370:

PYTHON_LIBRARY="$(find "$PYTHON_LIBDIR" -maxdepth 1 -name 'libpython3*.so*' -print -quit)"

That directory holds libpython3.11.so.1.0, libpython3.11.so and libpython3.so, and -print -quit returns whichever comes first in directory order. libpython3.so is the stable-ABI forwarder and carries no version, so idapyswitch rejects it:

Cannot determine python library version for ".../libpython3.so":
Unsupported python version 0.0.0 ('') (3.8+ is required)

exit 110, and the GUI test is skipped.

The step hadn't changed since it last passed on 2026-08-04 — hosted Python moved 3.11.15 → 3.11.16, and the re-extracted toolcache now yields the forwarder first. It was always a coin flip. Fixed in #19 by asking sysconfig for INSTSONAME (falling back to LDLIBRARY, never PY3LIBRARY), which is deterministic, plus an echo of the chosen path so the next failure here names the library.

git cherry-pick cb19ded should apply, though the path moved, so it may want a hand.

2. The reason this went unnoticed is worth a look while you're in here

licensed-linux is gated on github.event.pull_request.head.repo.full_name == github.repository. Every PR since 2026-08-12 has come from your fork, so the job reported skipped — 18 consecutive runs, including all of this PR's. It only surfaced because #18 was a branch on the origin repo.

So the licensed IDA job has given no signal on #15, #17 or #14, and skipped reads as "not failing" in the checks list. This PR's CI reorganisation already notes that skipped workflows report no status and so can't be required checks; that's the same gap seen from the other side. Worth deciding whether a PR that touches IDA code should fail loudly when the licensed job didn't actually run, rather than looking green.

3. main moved

  • Pick the versioned libpython for idapyswitch #19 cb19ded — the idapyswitch fix above.
  • Build a fresh SMDA report outline per function query (1.1.10) #18 31ccb46 — 1.1.10. This is the SmdaReport.getFunctions() caching bug from your second-pass list, ported to the current layout and released, since the smda pin is unbounded (>=4.3.10) and 1.1.9 was broken for anyone installing today. It also covers the outline going stale when local_smda_report is replaced on the upload-on-close path. It follows the same approach as McritSession.getLocalSmdaReportOutline here, so the two shouldn't diverge, but the version bump to 1.1.10 and tests/test_smda_report_outline.py will need reconciling on rebase.
  • docs: add DeepWiki badge #14 — the DeepWiki badge, one README line. Note its URL hardcodes danielplohmann/mcrit-plugin, so it joins the list of things the org move touches.

Still on our side to answer, unchanged from your list: the ida-v* tag scheme, whether exporter agreement gates releases and at what threshold, exporter upstream vs here, Ghidra packaging, and how this lines up with the org move.

McritInterface and the widgets no longer call IDA APIs directly. They use
helpers/Backend.py, an abstract interface covering input file metadata,
SMDA export, cursor/selection, function names, navigation, dialogs, UI
thread dispatch and CFG display. helpers/IdaBackend.py implements it for
IDA, which prepares the ground for additional disassembler backends.

- IdaProxy is removed; only 9 of its 76 wrappers were still used.
- The unused registerHotkey/HOTKEYS path is removed; it relied on
  idc.AddHotkey, which current IDA versions no longer provide.
- McritInterface takes the backend explicitly, so HeadlessMcritContext
  can pass one without Qt. convertIdbToSmda* become convertToSmda*.
- Backends return None instead of BADADDR. As a result the YARA string
  builder falls back to the cursor address when nothing is selected,
  instead of receiving BADADDR as the selection start.
Everything except the IDA entry point now lives under a single uniquely
named package, split by disassembler dependency:

- mcrit_plugin/core: McritInterface, the Backend interface, settings,
  Qt shim, and the vendored minimcrit/pylev/pyperclip.
- mcrit_plugin/widgets: the Qt widgets shared across disassemblers.
- mcrit_plugin/ida: IdaBackend, SmdaGraphViewer, and the ida-settings
  binding.

Disassemblers such as Binary Ninja load all plugins into one Python
process, where generic top-level module names like config, helpers and
widgets can collide with other plugins.

config.py is split accordingly. mcrit_plugin/core/config.py provides
McritConfig, which holds the setting defaults, type coercion and table
layouts and reads values through a getter supplied per disassembler.
Settings are now read on access instead of being snapshotted at import.
mcrit_plugin/ida/config.py keeps the plugin VERSION and binds McritConfig
to ida-settings. config_override.json is still read from the plugin
root.

Packaging, the metadata/settings sync checks, ruff excludes, tests and
docs follow the new paths.
The GUI smoke test ends with qexit(), which calls exit() from inside the
startup script without returning to Qt's event loop. Deferred deletions
queued by the widgets (on macOS, style animations) were then delivered
during C++ static destruction, where QObject teardown hit std::terminate
and IDA aborted after the test had already passed.

Close and delete the form's parent widget and drain DeferredDelete events
before calling qexit(), on both the success and failure paths.
McritSession (mcrit_plugin/core) now holds the cross-widget state, the
widget setup, and the helpers the widgets call on their parent, plus the
unsynced-function-name check and re-upload used on close. Mcrit4IdaForm
combines it with IDA's PluginForm, so other disassembler frontends can
host the same widgets without duplicating this code. Qt and the widget
modules are still imported lazily, keeping IDALib plugin loading free of
Qt imports.

QtShim no longer requires idaapi: outside IDA it selects PySide6, which
is what IDA 9.2+ uses as well.
The repository root is now also a Binary Ninja plugin (plugin.json,
__init__.py, requirements.txt) built on the shared mcrit_plugin core and
widgets.

- BinjaSmdaInterface implements SMDA's BackendInterface over a
  BinaryView and is passed to SMDA's IdaExporter, so reports come from
  Binary Ninja's own analysis in the same format as IDA exports. Block
  successors and call targets provide the flow references, since
  Binary Ninja's code-reference API also returns data references.
- BinjaBackend implements the Backend interface: input file hashes,
  cursor/selection from the active view frame, undoable renames, main
  thread dispatch, native message boxes and save dialogs, and remote
  CFGs rendered as FlowGraph reports with matched blocks highlighted.
- Settings are registered under Settings > MCRIT from the declarations
  in ida-plugin.json, so both frontends share one settings definition.
- The MCRIT sidebar uses PerViewTypeSidebarContext like Binary Ninja's
  built-in Tags/Strings/Memory Map sidebars (one session per binary
  view). UI actions for converting, uploading, matching, exporting,
  YARA strings and function/block queries are available from the
  command palette and Plugins > MCRIT. A close hook offers to upload
  renamed functions when submit_function_names_on_close is set.

Shared code no longer names IDA in user-facing text: the backend
provides its display name and the producer string recorded in uploaded
SMDA reports ("MCRIT4IDA" is unchanged for IDA). The IDA archive
excludes mcrit_plugin/binja.
…e test

Binary Ninja's sidebar can give the MCRIT panel less height than the
widgets' minimum size, which squeezed the Block Scope and Function Scope
controls and the sample info rows into overlapping lines. The sidebar
now hosts the widgets in a QScrollArea, so they keep their minimum size
and scroll instead. The scope controls use a single zero-margin grid
instead of nested per-column layouts, and the activity/server/sample
status labels word-wrap, so the panel needs no horizontal scrolling at
common sidebar widths.

scripts/run_binja_smoke.py runs tests/binja/smoke.py inside Binary Ninja
against a live MCRIT server using a throwaway user directory. It checks
settings and action registration, the sidebar, conversion, upload,
matching job creation and selection against a reference sample,
cursor-following function queries, undoable renames, and the CFG graph
report.
Binary Ninja:
- Export, upload and convert build the SMDA report through
  Backend.run_background. Binary Ninja runs it in a BackgroundTaskThread
  after waiting for analysis to finish (update_analysis_and_wait is not
  allowed on the UI thread), then applies the result on the main thread;
  IDA keeps running it synchronously. LocalInfoWidget activity updates
  go through a queued Qt signal so they are safe from worker threads.
- minimumbinaryninjaversion is the build number of the latest public
  stable release (5.3.9757) instead of 6.0's 10601, which hid the plugin
  from stable-channel users.
- The API token setting is hidden; timeout, block size and score
  settings are registered as bounded numbers.
- Sidebar cursor refreshes are debounced, actions resolve the session
  of the exact view (Raw and PE views share a file session id), plugin
  registration is idempotent, call targets are collected only at call
  sites, and the plugin root is appended to sys.path instead of
  shadowing other modules.

Packaging and releases:
- GitHub source archives are indexed by HCLI for every release and are
  the first download location it picks, so HCLI installs received the
  whole repository. ida-plugin.json is now export-ignored, leaving the
  attached plugin ZIP as the only indexed IDA archive.
- Binary Ninja installs from source archives, so the shared settings
  declaration lives in mcrit_plugin/core/settings.json;
  verify_settings_sync.py keeps it identical to ida-plugin.json.
- IDA releases use ida-v* tags and are not marked latest, since the
  Binary Ninja extension manager reads plugin.json at the latest release.
  The offline dependency build only runs for IDA releases.
- HCLI prompts only for the server URL, username and API token.

IDA:
- Settings are read by plugin name, falling back to the call-stack
  lookup for plugins not installed through HCLI.
- Clipboard copies use Qt; the vendored pyperclip is removed because it
  could import PyQt5 and trigger IDA 9.2+'s PyQt5 shim prompt.
- run_on_ui_thread no longer falls back to running Qt code on the
  calling thread when execute_sync fails.
- The IDA manifest and entry point move to mcrit_plugin/ida/
  (ida-plugin.json, ida_mcrit.py). scripts/ida/package_plugin.py maps
  them to the archive root, which HCLI requires, and excludes the
  in-package copies so the archive holds a single ida-plugin.json. The
  repository root now only carries the Binary Ninja files that must live
  there (plugin.json, __init__.py, requirements.txt).
- Scripts are split into scripts/ida (packaging, metadata check, IDA GUI
  and IDALib runners), scripts/binja (GUI runner) and scripts/common
  (settings check, quality checks, fixtures, MCRIT seeding).
- The pytest suite moves to tests/core next to tests/ida and
  tests/binja.
- The Qt Designer mockup and config_override.json.template move to
  docs/; the template is still shipped at the archive root.
- Integration tests and runners are named after what they exercise
  (gui_integration.py, idalib_integration.py, run_gui_integration.py,
  run_idalib_integration.py) instead of "smoke", including their result
  markers, environment variables and log names.
- "hcli plugin lint ." is dropped from CI because the repository root is
  no longer an IDA plugin directory; the packaged ZIP is still linted.
…ped CFG edges in Binary Ninja

IDA:
- PluginForm.Show() was given WCLS_* close flags, which it interprets as
  unrelated WOPN_* bits. It now opens the form with WOPN_PERSIST
  (Show() adds WOPN_RESTORE itself).
- The per-database plugmod releases the form's view hook and module
  references in __del__ when the database closes without the form having
  been closed; OnClose shares the same release(). The unused
  plugin_t.run and icon_id are removed (PLUGIN_MULTI dispatches to the
  plugmod).
- Pseudocode views resolve the current function from the view's vdui_t
  instead of decompiling and scanning the ctree on every cursor event.
  Block lookup skips cursor positions without an address.
- The IDA GUI integration test checks function resolution for real
  disassembly and Hex-Rays pseudocode views.

Binary Ninja:
- The MCRIT API token entered in Settings is moved into the system
  keychain (SystemSecretsProvider) and the Settings value is cleared; it
  stays in Settings only when no keychain is available. "MCRIT\Clear
  Stored API Token" removes it.
- Remote CFG graph edges carry True/False branch types for conditional
  jumps (fall-through is the false edge) and Indirect for multi-way
  branches, so Binary Ninja colors them like its own graphs.
- The GUI integration test activates the sidebar through the context of
  the opened file; UIContext.activeContext() is None while the window is
  not active.
…exporter agreement

- mcrit_plugin/core has no GUI toolkit imports anymore: QtShim,
  ClassCollection and McritSession move to mcrit_plugin/ui_qt together
  with the shared widgets (mcrit_plugin/ui_qt/widgets). A test imports
  every core module with the Qt bindings blocked.
- Backend.mutation(title) groups database changes into one undoable
  step; Binary Ninja maps it to a single undoable_transaction (nested
  renames join the outer one) and bulk label import uses it. IDA keeps
  the default no-op.
- mcrit_plugin/core/revision.py reports the core commit. Source
  archives (Binary Ninja installs) expand it via export-subst, the IDA
  packager substitutes it, and checkouts resolve it with git. The plugin
  start message shows it, so reports from differently versioned plugins
  can be correlated.
- mcrit_plugin/headless/HeadlessBackend lets SMDA disassemble the input
  and keeps labels in memory. scripts/common/run_headless_integration.py
  drives conversion, upload, matching, result decoding and label import
  through it against a live MCRIT server, and a new CI job runs it on
  every push and pull request without a disassembler licence.
- scripts/common/compare_smda_reports.py compares reports from different
  exporters (and SMDA's own disassembly) by shared functions, identical
  PicHashes and CFGs, with an optional agreement threshold.
- The IDA archive also excludes mcrit_plugin/headless.
Bump the MCRIT server and SMDA versions used by the pytest, headless and IDA integration jobs to the current releases. The plugin's minimum smda>=4.3.10 requirement is unchanged.
Binary Ninja releases are published manually with Vector35/plugin_actions, the release action used by Vector35's sample plugin: it bumps plugin.json on the default branch, tags the bump commit with the bare version and publishes the latest GitHub release, which is what extensions.binary.ninja reads.

The checks run first in a read-only job on the default branch, and the release job refuses to publish if the branch moved in between. The IDA release workflow is renamed to ida-release.yml so both release paths are named after their disassembler.
The README now covers installing, configuring and using the plugin in IDA Pro and Binary Ninja, plus the version history. Layout, checks, integration tests and the release process move to docs/development.md.

Also corrects things that no longer matched the code: IDA usage (the plugin opens from Edit > Plugins or Ctrl-F4 and has no right-click menu), the Binary Ninja minimum version (5.3, as declared in plugin.json), the MCRIT version used for tests, and the manual IDA install path in AGENTS.md.
The plugin is only tested on Binary Ninja 6.0, so the extension manager should not offer it to older builds. 10601 is the 6.0 stable build.
The release workflow, guard and changelog check now use the new layout and release the IDA plugin from ida-vX.Y.Z tags. An IDA release is never marked as latest, because the Binary Ninja extension manager reads plugin.json from the latest release.

- ida-release.yml keeps the verify, build and release jobs, uses the scripts under scripts/ida and scripts/common, and lints only the plugin ZIP, since the repository root is no longer an IDA plugin directory.
- release_guard.py reads the versions from mcrit_plugin/ida and takes its tag prefix from the table; its tests move to tests/ida.
- The changelog check covers the files shipped in the IDA plugin: mcrit_plugin/core, mcrit_plugin/ui_qt, mcrit_plugin/ida and icons.
- RELEASING.md covers both plugins, and the Binary Ninja release steps move there from docs/development.md.
- CHANGELOG.md gains the Unreleased entries for Binary Ninja support, the new layout and the tag change.
- The headless integration and Binary Ninja release jobs run on Python 3.12, like the rest of CI.
GitHub only runs workflow files placed directly in .github/workflows, so the grouping is by file name: shared checks (pytest, ruff, changelog), and matching ida-* and binja-* workflows for packaging and releases.

- ida-package.yml takes the IDA metadata sync, ZIP build and HCLI lint out of ruff.yml. binja-package.yml is its counterpart: scripts/binja/verify_metadata_sync.py checks plugin.json against requirements.txt and the README and checks the source archive, then plugin.json is validated with a dry run of Vector35/plugin_actions.
- binja-release.yml gains the checks ida-release.yml already has: CI passed on the released commit, and metadata sync.
- build-offline-dependencies.yml becomes offline-dependencies.yml and is called by both release workflows, with a binja bundle built from requirements.txt. It listened for published releases, which releases created with GITHUB_TOKEN never trigger, so 1.1.7 to 1.1.9 shipped without bundles. It can still be run by hand for an existing release, and uploads with gh instead of a third-party action.
- The IDA release guard moves to .github/workflows/scripts/ida/.
Drops comments that restated the code, narrated steps, duplicated a fact stated elsewhere or recorded change history, and shortens the rest to the fact they carry. Comments carried over unchanged from main in moved files are left as they were. The Binary Ninja sidebar now records why it is not per-tab.
ida-package.yml, ida-tests.yml and binja-package.yml now filter on paths: each runs for its own plugin's files and for anything both plugins ship or check (core, ui_qt, icons, common scripts and tests, README, LICENSE, pyproject.toml, .gitattributes). pytest, ruff and the changelog check still run on every change, and the release workflows keep their tag and manual triggers, so their check that CI passed on the released commit still finds a run.

binja-package.yml also runs when an ida-plugin.json changes, because it checks that no ida-plugin.json ends up in the source archive.
SecretsProvider[name] raises KeyError instead of returning None, so the
"no keychain, keep the token in Settings" path was unreachable and the
Clear Stored API Token action threw. Use SecretsProvider.get() and also
reset the Settings copy when clearing, so a token kept there because no
keychain was available does not survive the clear action.

execute_on_main_thread_and_wait swallows exceptions from the callback;
run_on_ui_thread now captures and re-raises them on the caller's thread.
Background results are dropped once the sidebar widget is destroyed,
which happens whenever the user closes the tab mid-export.

getFunctionSymbols anchored its sub_ regex differently from
has_default_function_name and ignored the demangle argument; both now
agree. The undoable_transaction guard is gone since the API nests, the
sidebar icon is built with a composition mode instead of a per-pixel
loop, and the GUI test runner terminates the process before waiting.
IdaBackend never implemented mutation(), so importing labels left one
undo entry per function; it now records an undo point through ida_undo.
The form was a module global while the plugin is PLUGIN_MULTI, so the
first database to close released the form of the second; each plugmod
owns its form and a falsy Show() is treated as failure. execute_sync
callbacks must return an int, and ask_yn/ask_file take printf formats.

Legacy idaapi imports are replaced by their ida_kernwin, ida_nalt,
ida_idaapi and ida_graph homes, the selection is read atomically with
read_range_selection, and the headless backend now reports an unnamed
function as non-default like the GUI backends do.
Under pwsh, .\venv\Scripts\activate ran activate.bat in a child shell,
so every pip step used the runner's interpreter and the wheelhouse was
the global site-packages. The steps call the venv's python directly,
the matrix no longer fails fast, and the job has a timeout.

The IDA tag-on-main check goes through the compare API so it works
without persisted credentials on a private repository. The changelog
gate now covers mcrit_plugin/binja, the MCRIT service venv is Python
3.12 in every workflow, the package workflows cancel superseded runs,
and pytest.yml reads RUNNER_TEMP from the environment.
Fixes wrong or stale statements: the manual install needs requests,
the IDA integration tests do run for same-repo pull requests, the
release-create step is not idempotent so failed releases need the
documented recovery steps, 1.4.5 is also a taken Binary Ninja version,
the offline binja bundle is Windows-only, and the keychain is only used
where one is available. The path-filter note lists the shared and
backend-only paths exactly as the workflows do, and AGENTS.md no longer
duplicates development.md and RELEASING.md or claims py38.
Backend.run_background's default called on_done(work()) with no error
path, and IdaBackend used it, so a failed SMDA export in IDA raised out of
the Qt slot into the Output window while Binary Ninja users got a warning
dialog. IDA's API is main-thread only, so the work stays synchronous, but
it now runs behind a wait box and a failure logs the traceback and shows
the same warning as on Binary Ninja.
@r0ny123

r0ny123 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the full pass; the summary table is a useful record.

6. run_background on IDA. Done in the latest commit, along the lines you suggest: IdaBackend.run_background runs the work synchronously behind a wait box (IDA's API is main-thread only, so that part stays), and a failure logs the traceback to the Output window and shows the same "… failed, see the Output window for details." warning Binja users get, instead of raising out of the Qt slot. _building is reset on that path as before. Two unit tests cover the success and failure paths with stubbed ida_kernwin; the changelog and the description's review notes are updated.

OnBeforeCloseFile granularity. Intentional, as you read it: each view type of a file has its own session and its own report, so each gets its own prompt. There is a comment on the loop now.

smda==4.8.0 pin. Agreed on both counts: newest is the right default and the bottom of the >=4.3.10 range is untested. Noting it here rather than adding a second matrix entry.

That closes 1, 4, 5 and 6 with code, and 2 and 3 as documented behaviour. Nothing left on my list from the review; the remaining decisions are the ones in "Needs a decision before merge" plus the fork-PR red check.

danielplohmann and others added 2 commits September 16, 2026 15:56
A fork pull request cannot obtain the IDA licence secrets, so failing this
job made every external contribution show a red check that the contributor
had no way to clear.

The job still exists for the reason it was added: a skipped licensed job must
not read as a pass, which is how the idapyswitch breakage survived six weeks
and eighteen fork pull requests. It now says so as a warning and in the step
summary instead of failing. A genuine failure of the licensed job is still red
on that job itself, so nothing that was blocking a real problem stops doing so.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Nothing in the versioning scope as it was written changes: the settings keys,
the minimum IDA version and the Python dependencies are identical to 1.1.10,
and `hcli plugin config mcrit-ida ...` and `config_override.json` keep working.

What does change is how the plugin is installed. Copying a repository checkout
into the plugins directory was a documented method in the README and is not one
any more, because `ida-plugin.json` and `ida_mcrit.py` now live under
`mcrit_plugin/ida/` and only the packaged ZIP has them at its root. That is a
backwards-incompatible change to a supported install path, so RELEASING.md now
names installation as part of the scope and says why 2.0.0 is major without a
setting, floor or dependency having moved.

The Binary Ninja plugin keeps its own version line and is unaffected.

Dated 2026-09-17 to match the planned org move; adjust the heading if that slips.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@danielplohmann

Copy link
Copy Markdown
Collaborator

Two changes pushed, and a note on incorporating your replies.

licensed-result now warns instead of failing (769f2c5)

Decided: a fork pull request cannot obtain the licence secrets, so a red check there is one the contributor has no way to clear. The job still exists for the reason you added it - a skip must not read as a pass, which is how the idapyswitch breakage survived six weeks and eighteen fork pull requests - it just says so as a warning and in the step summary. A genuine failure of the licensed job is still red on that job itself, so nothing that was blocking a real problem stops doing so.

The IDA plugin releases as 2.0.0 (410fda2)

I went looking for a semver justification and the obvious one is not there. Against the scope as RELEASING.md stated it, this breaks nothing: plugin name, entry point, idaVersions >=9.0, all three pythonDependencies and all 18 settings keys are identical to 1.1.10, and hcli plugin config mcrit-ida ... and config_override.json keep working. On that scope alone it is a 1.2.0.

The break is the one your own changelog entry already names: "A repository checkout is no longer an IDA plugin directory; install the packaged ZIP." The README on main documents copying the repository into $IDAUSR/plugins/mcrit-ida/ as a supported method, and it stops working. That is backwards-incompatible in the way majors exist for, so the justification is that line rather than the size of the refactor.

So RELEASING.md now names how the plugin is installed as part of the scope, and says why 2.0.0 is major although no setting, floor or dependency moved - otherwise the entry contradicts the policy #15 established across six repositories three days ago, and the first thing a reader does is check the scope and find nothing that qualifies.

[Unreleased] became ## [2.0.0] - 2026-09-17, dated to the planned org move; adjust the heading if that slips. Binary Ninja keeps its own line and is unaffected. The ida-v1.2.0rc1 example in the pre-release entry is left as an example.

Checks on the bump: verify_metadata_sync.py --expected-version 2.0.0, verify_settings_sync.py, 196 pytest, ruff check and format all pass, and release_guard.py --tag ida-v2.0.0 accepts the tag and extracts the section as notes.

On your replies

Two of my six findings were worse than the evidence supported, and your replies corrected them:

  • (2) updateCurrentFunction. I described it as "live tracking used to keep showing the last function, now stops refreshing". That is wrong: as you point out, the old path reached current_function == last_viewed and returned anyway, so the visible result is the same. The real difference is narrower - with live tracking off, a cursor move in such a view no longer clears the table and re-prints "deactivated".
  • (4) mutation() nesting. I called it the one I would want settled before shipping. You measured that nested transactions already collapse to one undo step in 6.0.10601, so §8.1 held before the guard. Porting _mutation_depth is still right - it makes it a property of the interface rather than of how Binary Ninja happens to behave - but it was not the hazard I implied.

The other four are closed as you describe. Nothing outstanding from the review on my side.

Sequencing unchanged: this lands at the org move, planned for tomorrow. Decisions on the five open questions are in #16.

@r0ny123

r0ny123 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

Both pulled and checked here: 196 pytest, ruff, metadata sync at 2.0.0 and actionlint pass on 410fda2. Agreed on both.

  • Warning instead of failure: the right call for the reason you give. docs/development.md still described the check as failing, fixed in 8f74e26, and the PR description now matches.
  • 2.0.0: the install-method break is the honest justification, and naming how the plugin is installed in RELEASING.md's scope is what makes the entry consistent with the policy from Release on a tag from the changelog, with the checks that were memory before #15. The 2026-09-17 heading is fine; I will adjust it if the move slips.

Thanks for the corrections on (2) and (4) as well. Nothing outstanding from my side either.

The org move that familiary#17 lands at moved to 2026-09-18, so the heading would have
claimed 2.0.0 shipped the day before it did. release_guard.py's SECTION regex
validates the date's format but never compares it to the tag day, so a stale
date passes every gate silently - it has to be caught by hand or not at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@danielplohmann

Copy link
Copy Markdown
Collaborator

@r0ny123 heads-up — I pushed one commit to this branch directly (d308a39), using maintainer_can_modify. Flagging it rather than leaving it to be discovered.

What changed: the ## [2.0.0] changelog heading, 2026-09-17 → 2026-09-18. Nothing else.

Why: this PR lands at the org move, and the move slipped by a day. The heading would otherwise have dated 2.0.0 to the day before it actually shipped.

Worth knowing for the cut itself: release_guard.py's SECTION regex

SECTION = re.compile(r"^## \[v?(?P<version>[0-9][0-9a-z.]*)\] - (?P<date>\d{4}-\d{2}-\d{2})\s*$")

captures the date but only ever validates its format — it is never compared against the day the tag is pushed. So a stale date here passes every gate silently and reaches the published release notes. It has to be caught by hand, which is the only reason this needed a commit rather than a CI failure.

If the move slips again, this heading needs moving again.

ask_file and ask_yn take the prompt as their printf format. IDAPython's
wrappers drop C varargs, so the extra "%s", prompt arguments left IDA
with a bare "%s" and no value to fill it. The prompt is now the format,
with any "%" escaped.

Closing the form destroys its widgets but kept the McritSession, so
Ctrl-F4 rebuilt empty widgets over the previous session's reports:
cursor queries used the old report and Convert kept it. Reopening now
creates a new form, as it did before the form moved to the plugmod.

The ida-settings fallback to get_current_plugin_setting() could never
succeed: it resolves the same plugin name from ida-plugin.json and repeats
the lookup that just failed. A plugin that is not installed now reads the
defaults, and PluginNotInstalledError no longer escapes McritConfig.
With live query on and no server reachable, every cursor move logged a
full ConnectionError traceback. Transport errors are already described
in the activity line, so the traceback is kept for errors that point at
a bug in the plugin.

Also in the core: the unused IDA 6.x import workaround in McritInterface
is removed, pylev is byte-identical to the vendored copy again (only its
location changed), the no-GUI test also rejects imports of the ui_qt,
ida and binja packages, and theme_color and HeadlessMcritContext say
what they actually do.
- RELEASING.md: the Binary Ninja release refuses 1.1.10 (tag v1.1.10),
  and 1.4.5 was only ever tagged on a fork. Only IDA release notes are
  generated from CHANGELOG.md.
- The Changelog check also covers mcrit_plugin/__init__.py and the root
  plugin.json, __init__.py and requirements.txt, which ship in the
  plugins as well.
- CHANGELOG.md: 1.1.10 also shipped without offline bundles, and the
  entries for the error messages, the upload on close, boolean override
  values and SMDA backend selection record behaviour that changed.
- AGENTS.md and docs/development.md match the tree; the Binary Ninja
  runner names its user directory only when it is kept.
- The repository moved to familiary, so ida-plugin.json, RELEASING.md
  and the changelog links name it directly instead of via the redirect.
@r0ny123
r0ny123 marked this pull request as ready for review September 28, 2026 12:50
- A rejected upload or job query (a 5xx from MCRIT, a 401/403 from
  MCRITweb) makes McritClient answer None; addReport's None was
  unpacked and getQueueData's iterated, so since the reworded failure
  messages it showed "unexpected TypeError", logged a traceback and
  reset the server label. Both now report "Upload failed." or "Job
  query failed.". queryFunctionEntriesById's docstring says what None
  and {} mean.
- Binary Ninja reports a cursor move to the sidebar only after 150 ms,
  so double-clicking a Function Overview row queried the function the
  cursor was on before, and Query Current Function before the first
  cursor move had none. The double-click sets the current function, as
  Block Scope already does, and a new sidebar takes it from its frame.
- Sidebar widgets were matched by file and view type only, so actions
  and Symbols-pane navigation in a file split into a second tab reached
  the first tab's widget. The widget whose view frame matches is
  preferred, with the old match as the fallback.
- SMDA leaves an unnamed function's name empty where IDA and Binary
  Ninja say sub_<address>, so the headless backend's
  has_default_function_name never returned True. An existing function
  with an empty or sub_ name is default now.
- The activity line showed UTC as a bare clock time; it shows the local
  time. A Convert, Upload or Export click while a report is being built
  says so instead of being dropped. Binary Ninja's function_min_score
  accepts 50 to 100, the spinbox's range.
- core_revision asks git only when the plugin folder is a checkout
  itself, so a plugin inside another repository no longer reports that
  repository's HEAD, and on Windows it opens no console window.
…rver

- The Binary Ninja GUI test runs "Clear Stored API Token", which
  deletes mcrit.mcritweb_api_token from the operating system's keychain.
  The throwaway user directory does not isolate that, so a run would
  delete a developer's real token after the sidebar had sent it to the
  test server. The test points the plugin at a secrets provider that
  does not exist; tests/binja/test_secrets.py covers the keychain path
  with a stubbed binaryninja instead.
- MCRIT MinHashes a function only above 10 instructions and refuses a
  query for a smaller one; the tests picked functions with 10 or more.
- The seeded reference is submitted as a binary, which gives it no
  labels, so the label checks only passed against a server that already
  had some. The seed script submits its SMDA report once more, which
  makes MCRIT add the function names as labels, unnamed functions named
  after their offset.
- The Binary Ninja test ran menu actions with a context that has no UI
  context, so they did nothing while another application had the focus.
- The IDA GUI runner analyzed the input in place, so IDA reopened an
  earlier run's database with its renames; it analyzes a copy in an
  empty directory. It removes the -L log first and reads only what this
  run appends to a caller's IDALOG, so an old success marker cannot pass
  a failed run. hcli wrote the test settings into ida-config.json before
  the runners took their snapshot; the snapshot comes first now.
- McritClient.awaitResult never gives up, so a dead worker held the
  licensed runner for six hours. The IDA tests wait within their timeout
  and stop at a failed job, the IDALib runner bounds its test process
  and keeps its output on a timeout, and the licensed jobs get
  timeout-minutes. The IDA GUI test names the path each navigation
  check took.
- CI runs against MCRIT 1.12.0; 1.10.0 to 1.12.0 came out after the
  1.9.0 pin.
- The frontend unit tests move out of tests/core: those of the IDA
  entry point and backend to tests/ida, those of McritSession to
  tests/ui_qt, with a test of the names the upload on close patches.
  The package and IDA test workflows start for tests/ui_qt and
  mcrit_plugin/__init__.py. An unused ida_settings stub is removed.

With these the Binary Ninja GUI test passes 166 checks and the IDA 9.3
GUI test 144 in autonomous mode against a new MCRIT 1.12.0 server, and
the IDALib and headless tests pass.
… date

- ida-plugin.json and the README's DeepWiki badge name
  https://github.com/familiary/mcrit-plugin, where the repository now
  lives, and the changelog says so.
- RELEASING.md: main is protected by a ruleset that requires pull
  requests, so the Binary Ninja release needs a bypass to push its
  version commit, and HCLI indexes only the ten most recent releases,
  so Binary Ninja releases can push an IDA release out of view, which
  another IDA release fixes, as decided in familiary#16. The HCLI link points at
  the HCLI docs.
- README.md says the Binary Ninja sidebar reads the connection settings
  when it opens for a file; plugin.json no longer implies that matching
  follows the cursor by default.
- AGENTS.md and docs/development.md describe the test layout, which
  requests run on the UI thread, the Python and MCRIT versions CI uses,
  what the IDA GUI runner leaves in a real profile, and the real path of
  the ruff-excluded mockup.
- CHANGELOG.md leads 2.0.0's Changed list with the install change that
  makes it a major release, states the tag change once, says that
  release headings carry the IDA version, moves the workflow's tag
  handling under Security, drops contributor-only notes, corrects the
  Python 3.12 rationale (smda still supports 3.11), says the boolean
  override fix applied only where an override was read, and records the
  undo steps in IDA, the label fetch cache, the local time, Qt's
  clipboard and the 1.1.10 bugs this release fixes.

@danielplohmann danielplohmann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review of the fourth and fifth passes (d308a39..a60ca63); everything before d308a39 was covered in the earlier four batches. Nothing blocks the merge. One should-fix, verified in IDA, and a few nits. Unit tests (214) and ruff pass on the head.

Should-fix

mcrit_plugin/ida/IdaBackend.py:161-169: the % escaping for ask_yn / ask_file is wrong. We checked it in IDA 9.3 batch mode. IDAPython passes the string to the kernel as data, not as the printf format, and drops any extra arguments:

  • ask_yn(0, "100% sure %s") shows 100% sure %s literally
  • ask_yn(0, "a%%b") shows a%%b, not a%b

So the fourth pass got one half right: "%s", prompt did show a bare %s. But .replace("%", "%%") makes any prompt that contains % show %%. No current prompt contains one, so nothing is visible today. Fix: pass prompt unchanged, correct the comment at :161, and change tests/ida/test_ida_backend.py:59, which asserts the doubled %%.

SMDA 4.9.0

  • The Binja path (IdaExporter(config, ida_interface=...) plus _explicit_backend) was run against real 4.9.0 with a stand-in interface. The report comes back ok, with the right architecture, base, functions, names and PicHashes. The 4.9.0 Exporter calls the same 12 interface methods as 4.8.0.
  • The IDA path Disassembler(backend="IDA") looks fine on 4.9.0 from reading the tag, but has not been run.
  • Please move the CI pins from smda==4.8.0 to 4.9.0 in this PR rather than in #22: pytest.yml:62, ida-tests.yml:263/371/646, docs/development.md:122. The IDA plugin requires smda>=4.3.10 without an upper bound, so 2.0.0 users get 4.9.0, and a newer SMDA is exactly what broke 1.1.9. Note that the pytest job itself never touches real SMDA, because tests/conftest.py stubs it and the job doesn't install it. Only the headless job and the licensed IDA job do, so the licensed job is the one that has to run on 4.9.0. I'll dispatch it on an origin branch before tagging.

Nits

  • CHANGELOG.md:79-81: "lets SMDA choose for other non-x86 architectures" is not what happens. IdaInterface.getArchitecture() raises Unsupported Architecture for ARM32/MIPS/PPC, and Disassembler()._disassemble does no auto-detection (on 4.9.0: "No disassembly backend available for architecture 'arm'"). The result is fine, since it fails early with the warning. Only the wording is off.
  • .github/workflows/changelog.yml:49: the shipped-files pattern leaves out mcrit_plugin/headless/, which is not export-ignored and so is in the Binja source archive. Low impact, unless the pattern is meant to mean "everything in the archive".
  • mcrit_plugin/binja/McritSidebar.py:186-191: when no widget's view_frame matches, _widget_for_view falls back to the first tab's widget. That is the old behaviour, but it means the tab-routing fix doesn't cover a split pane the second tab's widget hasn't seen yet.
  • tests/binja/gui_integration.py:1145-1149: the keychain override relies on SecretsProvider.get() returning None for an unknown name rather than raising. Not verified here, since there's no Binja install.

Checked and correct

  • The ida-settings fallback: get_current_plugin_setting repeats the same lookup, and PluginNotInstalledError could escape McritConfig.
  • The form is rebuilt after close.
  • Tracebacks are skipped only for RequestException, and every path still writes a status line.
  • addReport(...) or (None, None) and getQueueData returning None match the vendored client.
  • MINHASH_FN_MIN_INS uses a strict >.
  • Runner hardening:
    • ida-config.json is snapshotted before hcli and restored every time.
    • The log is deleted up front, so an earlier run's marker can't pass.
    • IDA always analyses a fresh copy.
    • Timeouts are bounded and their byte output is decoded.
  • revision.py accepts a .git file.
  • pylev is back to identical.
  • The no-GUI-imports test resolves relative imports.
  • All URLs name familiary.
  • The reserved-version list in RELEASING matches the remote tags.

Decisions from "Needs a decision before merge"

  • Binja network work on the UI thread: later, as a follow-up issue. It matches what IDA does, so it isn't a regression.
  • First Binja version: 1.0.1 is fine. I'll set up the ruleset bypass for GitHub Actions before the first run.

IDAPython fixes the printf format of ask_yn and ask_file to "%s" and
passes the prompt as its argument, so doubling "%" made a prompt that
contains one show "%%". The prompt is now passed unchanged.

The IDA plugin requires smda>=4.3.10 without an upper bound, so 2.0.0
users install SMDA 4.9.0. The CI jobs that run real SMDA now pin that
version. README notes that Python 3.10 stays on SMDA 4.3.10, the last
release for it.

The changelog check also counts mcrit_plugin/headless/, which ships in
the Binary Ninja archive. The changelog no longer claims that SMDA picks
a backend for other non-x86 architectures; it has none for them.

@danielplohmann danielplohmann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving at 7aa4f95. It addresses the review of the fourth and fifth passes. The licensed IDA 9.3 job ran on this exact commit from an origin branch against smda 4.9.0 (run 36470679341): 144 PASS, 0 FAIL, smda 4.9.0 in both the IDALib and GUI runtimes.

@danielplohmann
danielplohmann merged commit 15f5789 into familiary:main Sep 28, 2026
19 checks passed
@r0ny123

r0ny123 commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. All points are addressed in 7aa4f95:

  • ask_yn and ask_file get the prompt unchanged. IDAPython's (const char *format, ...) typemap in tools/deploy/header.i.in fixes the format to "%s", as you found. The comment and the test are corrected.
  • CI and docs/development.md pin smda 4.9.0. With 4.9.0, the IDA 9.3 GUI test (144 checks), the IDALib test, the Binary Ninja GUI test (166 checks) and the headless test pass locally on this PR, and they pass on Fix label import, scope queries and settings that shipped wrong in 1.1.10 #23 and Export Binary Ninja reports through smda.binja #22 as well.
  • The changelog's architecture bullet is reworded, and the changelog check counts mcrit_plugin/headless/.
  • The split-pane fallback in _widget_for_view stays as it is and is listed under follow-ups. Routing a pane to its own tab needs a frame-to-tab lookup and a split-pane GUI test to prove it.
  • The keychain override: SecretsProvider.get in Binary Ninja 6.0 (binaryninja/secretsprovider.py) catches the KeyError and returns None. The GUI test passes on 6.0 and leaves no MCRIT item in the keychain.

Your two decisions are recorded in the description. #23 and #22 are rebased onto 7aa4f95 and ready for review.

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