Vector35 / Vector35/binaryninja-api
Session Scoped Logs From Workflow Land in Wrong Session When Opening Multiple Files From Project
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Version and Platform (required):
- Binary Ninja Version: 5.3.8844-dev Ultimate, 29d8484
- OS: macos
- OS Version: 26.2.0
- CPU Architecture: arm64
Bug Description:
If you open more than one file simultaneously from a project and are using a custom workflow plugin, even if you scope the logs to the session id retrieved from the binary view, the logs end up in the wrong session.
Steps To Reproduce:
- Paste the workflow plugin below into a python file.
- Set this workflow in a project.
- Open two or more raw files. I suggest four or maybe five because this bug is non-deterministic. The logs may just all land in the right place, but the more files you open simultaneously, the higher the probability that you will be able to observe the bug on the first try.
- Look at the logs in all the files. You will see some where two or more sets of logs from another session are marked with the file you're looking at's session id, and if you look at other files, their logs for this workflow plugin are not there.
Expected Behavior:
Scoped logs landing in correct places.
Screenshots:
Here is one file where there are two separate logs coming from this workflow plugin. Note that the session ID appears correct according to other activity from other analysis components, it's just assigning that session ID to logs from another binaryview session (or something like that).
Here are the logs for the file that one of the two in the above screenshot belongs to:
Additional Information:
import json
from binaryninja.log import Logger
from binaryninja.workflow import Workflow, Activity
log = Logger(0, 'reprobug')
def do_action(ctx):
bv = ctx.view
log.session_id = bv.file.session_id
tagged = 0
for f in bv.functions:
f.add_tag('Needs Analysis', 'BUGBUG')
log.log_debug(f'Tagged fuction at: {f.start}')
tagged += 1
log.log_info(f'Tagged functions: {tagged}')
wf = Workflow('core.module.metaAnalysis').clone('plugin.module.ReproBug')
activity_name = 'analysis.reprobug'
wf.register_activity(Activity(
configuration=json.dumps({
'name': 'analysis.reprobug',
'title': 'Repro Bug',
'description': 'Repro Bug.',
'eligibility': {
'runOnce': True
},
'dependencies': {
'downstream': ['core.module.update']
}
}),
action=do_action
))
wf.insert('core.module.finishUpdate', ['analysis.reprobug'])
wf.register()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python reproduction using Logger, Workflow, Activity, and bv.file.session_id, then reproduce it by opening several raw files simultaneously. Trace how session_id is assigned while workflow actions and log methods run; done means each workflow log appears only in the matching Binary Ninja session.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100