Skip to content

Fix /load endpoint (unreachable + needs main-thread execution) #56

@mblsha

Description

@mblsha

Problem

POST /load is intended to load a binary from an external client, but it's currently blocked by the "binary must already be loaded" gate.

  • plugin/server/http_server.py do_POST checks _check_binary_loaded() for all paths except /logs and /console.
  • As a result, /load returns 400 {"error": "No binary loaded"} when called in an empty session, making it unusable as a bootstrap endpoint.

Repro

curl -sS -X POST http://localhost:9009/load \
  -H "Content-Type: application/json" \
  -d "{\"filepath\": \"/path/to/binary\"}"

Proposed fix

  • Add /load to the no-binary-required allowlist in do_POST.
  • Execute BinaryOperations.load_binary(...) on the main thread (e.g., binaryninja.mainthread.execute_on_main_thread_and_wait) to avoid UI/threading issues.
  • Define behavior for selecting/attaching the loaded BinaryView (set binary_ops.current_view) and whether to trigger analysis.

Notes

If /load is kept, document intended usage (UI vs headless) and consider gating (config flag and/or auth token) since it opens files and can be used alongside /console/execute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions