Repository navigation
Multi-backend plugin: shared core, IDA and Binary Ninja frontends - #17
Conversation
5bafb32 to
a81860d
Compare
|
Two things landed on 1. Please cherry-pick
|
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.
|
Thanks for the full pass; the summary table is a useful record. 6.
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. |
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>
|
Two changes pushed, and a note on incorporating your replies.
|
|
Both pulled and checked here: 196 pytest, ruff, metadata sync at 2.0.0 and actionlint pass on 410fda2. Agreed on both.
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>
|
@r0ny123 heads-up — I pushed one commit to this branch directly ( What changed: the 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: 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.
- 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.
0cbd154 to
a60ca63
Compare
danielplohmann
left a comment
There was a problem hiding this comment.
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")shows100% sure %sliterallyask_yn(0, "a%%b")showsa%%b, nota%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.0Exportercalls 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.0to 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 requiressmda>=4.3.10without 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, becausetests/conftest.pystubs 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()raisesUnsupported Architecturefor ARM32/MIPS/PPC, andDisassembler()._disassembledoes 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 outmcrit_plugin/headless/, which is notexport-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'sview_framematches,_widget_for_viewfalls 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 onSecretsProvider.get()returningNonefor 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_settingrepeats the same lookup, andPluginNotInstalledErrorcould escapeMcritConfig. - The form is rebuilt after close.
- Tracebacks are skipped only for
RequestException, and every path still writes a status line. addReport(...) or (None, None)andgetQueueDatareturningNonematch the vendored client.MINHASH_FN_MIN_INSuses a strict>.- Runner hardening:
ida-config.jsonis 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.pyaccepts a.gitfile.pylevis 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
left a comment
There was a problem hiding this comment.
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.
|
Thanks for the review. All points are addressed in 7aa4f95:
Your two decisions are recorded in the description. #23 and #22 are rebased onto 7aa4f95 and ready for review. |
#15 has merged into
main. This branch is based onf3003de; the only later commit onmain,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
Everything specific to a disassembler goes through
core/Backend.py. The widgets only talk toself.cc.backend, so a Ghidra backend just has to implement that one interface. A test scans every core module withastfor Qt, Binary Ninja and IDA imports at any nesting level, so none of them can creep back into core.IDA
ida-plugin.jsonnow lives atmcrit_plugin/ida/. The packager puts it at the zip root, so HCLI installs work the same.qexit(), so IDA no longer aborts on macOS. This is a test-harness fix; the plugin itself was not affected.plugmod_t.__del__releases the form and its hooks, andShow()now passesWOPN_*flags instead ofWCLS_*.get_widget_vdui(...).cfunc.entry_eaand no longer decompiles on every cursor move.Binary Ninja
plugin.jsonandrequirements.txtare at the repo root, and the minimum build is 10601 (6.0 stable).BinjaSmdaInterfacefeedsBinaryViewinto SMDA's exporter, the same way IDA's analysis is exported.PerViewTypeSidebarContext, which is what the built-in Tags/Strings sidebars use), plus actions under Plugins > MCRIT.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.BackgroundTaskThreadwith progress, and a bulk label import is oneundoable_transaction, so a single undo reverts it.FlowGraphwith true/false edge colours.Exporter agreement
scripts/common/compare_smda_reports.pydiffs reports of the same binary exported by different tools. On a small PE test binary: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
headless-integrationjob inpytest.yml. It starts mongo and MCRIT 1.12.0, builds two fixture variants, and runs convert → upload → match → label import withHeadlessBackend. It needs no licence, so it runs on forks too.scripts/binja/run_gui_integration.py). It runs the full workflow in a throwawayBN_USER_DIRECTORY. It needs a licence, so for now it's local only.RELEASING.mdfor why.mcrit_plugin/core/revision.py:export-substcovers 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-v*tag.ida-release.ymlis 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-onlyhclilint, and the release never marked latest. The guard reads the versions frommcrit_plugin/ida/, and its tests are intests/ida/. The changelog check coversmcrit_plugin/{core,ui_qt,ida,binja},mcrit_plugin/__init__.py,iconsand the rootplugin.json,__init__.pyandrequirements.txt.RELEASING.mdcovers both plugins, andCHANGELOG.mdrecords this PR in its[2.0.0]section.binja-release.yml, started by hand (Actions > Binary Ninja release, orgh workflow run binja-release.yml -f dry-run=true). It runs the checks read-only on main, then hands off toVector35/plugin_actions(same action as Vector35's sample plugin, pinned to v1.1.0). That bumpsplugin.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.plugin.jsonchanges. One gotcha: the old IDA tagsv1.1.4,v1.1.5andv1.1.7–v1.1.10block 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-package.yml(metadata sync, ZIP build,hclilint)binja-package.yml(plugin.json vs requirements.txt/README, source archive check, dry run ofVector35/plugin_actions)ida-tests.ymlida-release.ymlbinja-release.yml.github/workflows/scripts/ida/release_guard.pyplugin_actionsShared:
pytest.yml(pytest + headless MCRIT),ruff.yml(ruff + settings sync),changelog.yml, andoffline-dependencies.yml, which both release workflows call.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.mainhas no required checks today.release: published, which a release made withGITHUB_TOKENnever triggers, so 1.1.7–1.1.10 have no wheelhouse. Both release workflows now calloffline-dependencies.ymldirectly, and it can still be run by hand for an old tag.binja-release.ymlnow also checks CI passed on the released commit, same as the IDA one.Review pass
I went over the whole diff once more after the CI reorganisation and fixed what came up:
SecretsProvider[name]raises instead of returningNone, so the no-keychain fallback never ran and "Clear Stored API Token" could throw; clearing now also resets the Settings copy.run_on_ui_threadre-raises exceptions from the main-thread callback, background results are dropped once the sidebar widget is gone (tab closed mid-export), and thesub_filter in the exporter is anchored like the one in the backend. Settings are registered from the declared defaults, soconfig_override.jsoncan'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/andtests/areexport-ignored so the extension-manager install doesn't put those names onsys.path.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 falsyShow()is treated as failure,execute_synccallbacks return an int,ask_yn/ask_filetake the prompt as their format (see the fourth pass), and the legacyidaapiimports are replaced byida_kernwin/ida_nalt/ida_graph/ida_undo."false"is false..\venv\Scripts\activate, which under pwsh runsactivate.batin a child shell and activates nothing, so the wheelhouse was the runner's global site-packages. They call the venv'spython.exenow; 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/development.md,README.md,RELEASING.mdandAGENTS.mdare checked line by line against the tree (paths, commands, triggers, versions); duplicated text now points at one place.plugin.jsonmatches the sample plugin template field for field, andbinaryninjauiis imported beforePySide6as 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.SmdaReport.getFunctions()caches its result. The plugin reused one outline report for every function query and only swappedxcfg, so the first query worked and every later one silently re-queried the first function. A fresh outline is built per query now.notifyOffsetChangedisn't called for it); the plugin now also listens onUIContextNotification.OnAddressChange.is Noneon a{}), so SHA256 columns read "unknown" whenever the sample list could not be fetched at Convert.updateServerInfotouched a widget from a worker thread.arm/mips/ppc, which don't exist in SMDA.getThemeColor) instead of the fixed IDA palette; IDA is unchanged.ida_funcs.get_funcis deprecated in 9.4, soget_func_startis used when present;demangle_genericis deprecated since Binja 5.4, replaced bydemangle_any. Everything else the plugin calls is current. Two things left as they are:QCheckBox.stateChangedis deprecated from Qt 6.9 but the Qt5 path still needs it, andida-settingstries 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 twojumptochecks) do not run and IDA reports 144;--ui-sessionruns them. The IDA runner also copies the input to a fresh directory and pre-seedsidapython.cfg, so no modal dialog can block a run.Third pass: rebased onto
mainmaingained three merges after this PR opened, and the stack (#15, then this branch) is rebased onto them:cb19ded(idapyswitch picking the unversionedlibpython3.so) landed at the moved location inida-tests.yml.mcrit_plugin/ida/ida-plugin.jsonandconfig.pysay 1.1.10,CHANGELOG.mdhas its[1.1.10]section, and its regression test moved totests/core/test_smda_report_outline.py(nowtests/ui_qt/), targetingMcritSession, which already carried the same fix.skippedon 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:
ask_fileandask_yntake the prompt as their printf format (ida_kernwin), and IDAPython's wrappers drop C varargs, so the"%s", promptform from the first pass left IDA a bare%swith nothing to fill it. The prompt is the format again, with%escaped.McritSession, so Ctrl-F4 rebuilt empty widgets over the old reports. Reopening now builds a new form, as onmain.get_current_plugin_setting()could never succeed (it resolves the same name fromida-plugin.jsonand repeats the lookup), and itsPluginNotInstalledErrorcould escapeMcritConfig. A plugin that is not installed reads the defaults.McritInterfaceis gone (Fix label import, scope queries and settings that shipped wrong in 1.1.10 #23 removes the rest),pylevis byte-identical tomainagain, and the no-GUI test also catches relative and package-level imports ofui_qt,idaandbinja.mcrit_plugin/__init__.pyand the rootplugin.json,__init__.pyandrequirements.txt.RELEASING.mdlists the versions the Binja release really refuses (1.1.10yes,1.4.5no) and says only IDA notes come fromCHANGELOG.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.jsonand README's DeepWiki badge namefamiliary/mcrit-plugin.The GUI tests were re-run for the fifth pass; the results are under Tests / CI.
Fifth pass: since
87afe6dReview 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 beforeida-v2.0.0is tagged.ida-config.jsonwrongly after hcli, and could hang for hours on a dead worker. All fixed, and CI runs against MCRIT 1.12.0.tests/idaandtests/ui_qt.ida-plugin.jsonand README's DeepWiki badge namehttps://github.com/familiary/mcrit-plugin, where the repository now lives.RELEASING.mdnotes the ruleset onmainand 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
a60ca63One commit,
7aa4f95, for the review of the fourth and fifth passes:ask_ynandask_fileget the prompt unchanged. IDAPython fixes their format to"%s"(the(const char *format, ...)typemap in itstools/deploy/header.i.in), so the escaping showed%%.docs/development.mdpin 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.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:
_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.SecretsProvider.getcatches theKeyErrorfor an unknown name and returnsNone(binaryninja/secretsprovider.pyin 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.binjais #22, not this PR, because it needs an SMDA release that does not exist yet. The order is:refactor: move the export engine out of smda.ida danielplohmann/smda#360 (export engine out ofDone 2026-09-28.smda.ida), ci: accept binja as a PR title scope danielplohmann/smda#358 (binjascope), feat(binja): add Binary Ninja exporter as smda.binja danielplohmann/smda#357 (smda.binja) merge, in that order.SMDA 4.9.0 is released with them.Done; CI pins it from7aa4f95.mcrit_plugin/binja/BinjaSmdaInterface.py, importssmda.binjaand raises the Binary Ninja requirement tosmda>=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
d308a39is 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, nestedmutation()guard on Binja,viewcontract 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.updateCurrentFunctionnow returns whatget_current_functionfinds, andIdaBackendfinds 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.SampleInfoWidgetconnects onlyselectionChanged; clicking an already selected row no longer re-populates the family table, which only depends on that row.IdaBackend.run_backgroundkeeps 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
main's ruleset gets a bypass for GitHub Actions before the first run.To do at the release
danielplohmann/mcrit-plugin. Onceida-v2.0.0is published, check how the index lists 2.0.0 and whether an existing 1.1.10 install offers the upgrade; if it lists 2.0.0 separately, installs may needhcli plugin install mcrit-ida@https://github.com/familiary/mcrit-pluginonce.## [2.0.0]heading still says 2026-09-18, andrelease_guard.pychecks only its format. Whoever tagsida-v2.0.0, after Multi-backend plugin: shared core, IDA and Binary Ninja frontends #17 and Fix label import, scope queries and settings that shipped wrong in 1.1.10 #23 have merged, sets it to that day.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 inRELEASING.md);compare_smda_reports.py --min-agreementstays advisory, not a gate; Ghidra, address translation and splitting out view models are deferred.Follow-ups
McritClientwith MCRIT 1.12's (timeouts, job selectors, and thesample_group_onlyarguments it has that MCRIT's does not).Refs #16