feat(utils): add shared scanner package with MCP runner and RunAll orchestrator#1738
Merged
Conversation
…chestrator Signed-off-by: Catarina Paralta <clouropa@cisco.com>
2 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: Catarina Paralta <clouropa@cisco.com>
paralta
marked this pull request as ready for review
July 2, 2026 09:09
ramizpolic
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
dir-importerhad all security scanning logic isolated within its own packages, making it impossible for the reconciler to reuse it without duplication. This PR introducesutils/scanneras the shared home for scanner interfaces and runner implementations, so both the importer (companion PR indir-importerto follow) and the upcoming reconciler scan task can call into the same code.The package exposes three things: a
Runnerinterface that any scanner CLI wrapper implements; aRunAllfunction that executes all registered runners against a*corev1.Record, merges results, and returns a singleScanResult; andMCPRunner, the first concrete runner, which clones the record's source repository and invokesmcp-scanner behavioral --rawto detect malicious MCP server behaviours. Tests cover both the merge logic andRunAll's error-handling contracts (partial failure, all-fail, no runners).Runnertakes*corev1.Recorddirectly rather than an intermediate input type, which required addinggithub.com/agntcy/dir/apias a dependency ofutils/. This is intentional —utils/is released in lockstep withapi/, so the coupling is expected.RunAllreturns an error only when all runners fail; a partial failure is logged and skipped so a transient scanner outage does not silently reject records downstream.mergeis unexported;RunAllis the only public entry point for orchestration, keeping the surface area minimal for callers.