mercedes-benz / sechub

SecHub provides a central API to test software with different security tools.
https://mercedes-benz.github.io/sechub/
MIT License
272 stars 65 forks source link

Introduce Template and Asset healthcheck #3616

Open de-jcup opened 1 week ago

de-jcup commented 1 week ago

Situation

With the "template an assets" feature SecHub is able to handle different resources at runtime. It is possible to remove them, assign different assets to projects which have same product setup - so we are able to customize behavior when necessary at runtime.

While the PDS template prarameter is constructed, the SecHub server does automatically check if the template asset does contains a file ${PdsProductIdentifier}.zip inside database. If it is not available, the Server will throw an exception and the job will fail (without calling a PDS instance at all).

The situation happens only at runtime and it is not easy to understand as an administrator at the first glance why there is a problem etc.

Wanted

There shall be a possibility to check if the current situation with template and assets can lead to problems and how to solve them

Solution

We provide a REST endpoint for administrators: /api/admin/template/healthcheck

The call will inspect all asociations between

project->Template -> asset project->Profile->Executor (product identifier) + enabling states

When assets/${assetId}/${productIdentifier}.zip does not exist, the validation will mark this as serious problem and suggests to upload an empty zipfile as a workaround.

The result of the rest call shall be JSON:

{
  "assetFilesMissing" : [
      "template" : "template-x",
      "asset" : "asset-1",
      "file" : "$filename",

      "executionProfile" : "$profileId",
      "executorConfiguration" : "$executorId",

      "projects" : ["projectId1","projectId2", ".."],

      "suggestion" : "Create at least an empty zip file '$filename' and upload to asset $assetId"

  ] 
}