aquasecurity / kube-hunter

Hunt for security weaknesses in Kubernetes clusters
Apache License 2.0
4.75k stars 585 forks source link

Add tests for "active" mode #334

Closed iyehuda closed 4 years ago

iyehuda commented 4 years ago

What would you like to be added

Active hunters cannot be registered in tests since it requires config.active to be set. This cannot be done since import kube_hunter causes a default configuration to be loaded. In order to make things right, we need to get rid of this side-effect behavior and instantiate the handler object with configuration as argument (i.e., dependency injection). We also need to get rid of referencing config as global variable but rather pass it as argument to hunters and other consumers. We may use dependency-injector for this mission.

Why is this needed

It is needed to make code more testable and using best practices.