Skip to content

Add middleware loader#1589

Open
Schamper wants to merge 1 commit intomainfrom
middleware-loader
Open

Add middleware loader#1589
Schamper wants to merge 1 commit intomainfrom
middleware-loader

Conversation

@Schamper
Copy link
Member

Consider this a proposal/experiment for a middleware loader, which should facilitate making loaders like #1456 and #1214 easier. I've adjusted the VBK loader as test (which also immediately serves as a unit test).

@qmadev I remember you looked a bit at VBK too, besides the middleware loader itself, does the VBK loader change make sense to you?

@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.09%. Comparing base (54808a5) to head (8e48c16).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
dissect/target/loader.py 86.66% 2 Missing ⚠️
dissect/target/loaders/vbk.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1589      +/-   ##
==========================================
+ Coverage   81.02%   81.09%   +0.06%     
==========================================
  Files         400      401       +1     
  Lines       34965    34988      +23     
==========================================
+ Hits        28332    28372      +40     
+ Misses       6633     6616      -17     
Flag Coverage Δ
unittests 81.09% <89.28%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 26, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing middleware-loader (8e48c16) with main (0e9dfb4)

Open in CodSpeed

Comment on lines +53 to +54
# We should only have one candidate at this point
if len(candidates) > 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only change that does not make sense to me right now. Why are we not iterating candidates and loading the first "valid" one anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's been a while since I looked at VBK and I don't have access to any data anymore, so I might just be forgetting something.

Copy link
Member Author

Choose a reason for hiding this comment

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

This current setup doesn't really allow it because we can only return a single path, and I can't really think of a nicer way to allow that way, except for changing prepare to be an iterator instead of simply returning a path. I can maybe imagine a few more usecases where that could be useful, so maybe it's worth changing to that. Perhaps the reviewer can weigh in too.

But if I understand the logic in the VBK loader correctly, the candidates list should contain paths only if the globs for either vmx or vmcx succeeded, and otherwise the multiloader path. I don't expect there to be a valid way to create a VBK that contains both a vmx and a vmcx file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Allright, makes sense to me.

@qmadev
Copy link
Contributor

qmadev commented Feb 28, 2026

Other than that, it looks good to me. Seems like this would make sure you never have to look for a new loader within a loader anymore.

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