mitre / hipcheck

Automatically assess and score software repositories for supply chain risk.
https://mitre.github.io/hipcheck/
Apache License 2.0
73 stars 5 forks source link

feat: initial plugin startup and context management #278

Closed j-lanson closed 2 months ago

j-lanson commented 2 months ago

Note: this PR relies on #277 , and so that must be merged first.

This PR introduces the plugin module and some initial type definitions, as well as some code for turning a Plugin into a PluginContext object that will act as a wrapper interface for the gRPC channel (converting between tonic-generated types and "nicer" ones, maintaining the child process handle, etc.)`

The logic for how startup occurs is a first try, and should be subject to discussion. Rather than a MAX_CONN_ATTEMPTS to handle syncronizing the plugin process and Hipcheck, I would support adding a requirement that the plugin outputs to stdout some notifying message like "Ready." that we can wait for.

The code of this PR compiles, but is untested. It would require defining an actual plugin, and injecting a way to test this code into main.rs. We may want to consider switching to a library-style crate so that we can have multiple different bin/ files to enable easier testing of code such as this.