Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
package scan
import (
"net/http"
"github.com/danielgtaylor/huma/v2"
"github.com/getarcaneapp/arcane/backend/v2/internal/middleware"
"github.com/getarcaneapp/arcane/backend/v2/internal/vulnerability/children/scan/children/trivy"
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/handlerutil"
)
// RegisterRoutes registers the vulnerability scan and scanner status endpoints behind featureMiddleware.
func RegisterRoutes(api huma.API, h *Handler, featureMiddleware huma.Middlewares) {
trivy.RegisterRoutes(api, trivy.NewHandler(func() *trivy.Service {
if h.service == nil {
return nil
}
return h.service.trivy
}()), featureMiddleware)
middleware.RegisterWithPermission(api, huma.Operation{
Middlewares: featureMiddleware,
OperationID: "scan-image-vulnerabilities",
Method: http.MethodPost,
Path: "/environments/{id}/images/{imageId}/vulnerabilities/scan",
Summary: "Scan image for vulnerabilities",
Description: "Initiates a vulnerability scan for the specified image using Trivy",
Tags: []string{"Vulnerabilities"},
Security: handlerutil.DefaultOperationSecurity(),
}, authz.PermVulnsScan, h.ScanImage)
}