Compare commits

..

No commits in common. "37e531ebbc5e3b9d53dd20f216f9848d568b7704" and "6bb857f5a1a67614e5a7f1dbf74b6f9e6aef403d" have entirely different histories.

View File

@ -54,23 +54,13 @@ trivyScanImageCves() {
[ -n "$image" ] || { echo '[]'; return; } [ -n "$image" ] || { echo '[]'; return; }
command -v jq >/dev/null 2>&1 || { echo '[]'; return; } command -v jq >/dev/null 2>&1 || { echo '[]'; return; }
# Scan the app's LOCAL image via the docker socket mounted into the # Scan in CLIENT mode against the running server (--server localhost:4954,
# container (--image-src docker) so nothing is pulled from a registry — the # the container's fixed --listen port). Standalone `trivy image` would try to
# image is already present, and a privacy box may have no outbound at all. # open the vuln-DB cache the server already holds and fail with a cache-lock
# Client mode (--server localhost:4954, the container's fixed --listen port) # timeout; client mode leaves the DB to the server. --quiet keeps the
# leaves the vuln DB to the running server; a standalone scan would deadlock # progress spinner out of stdout; we only want CRITICAL..LOW findings.
# on the server's cache lock. For rootless the daemon socket lives under
# /run/user/<uid> (not trivy's default path), so point DOCKER_HOST at it;
# rooted's /var/run/docker.sock is found by default.
local envs=""
if [ "${CFG_DOCKER_INSTALL_TYPE:-}" = "rootless" ] && [ -n "${docker_install_user:-}" ]; then
local uid; uid="$(id -u "$docker_install_user" 2>/dev/null)"
[ -n "$uid" ] && envs="-e DOCKER_HOST=unix:///run/user/$uid/docker.sock"
fi
# --quiet keeps the progress spinner out of stdout; we only want CRITICAL..LOW.
local raw local raw
raw="$(dockerCommandRun "docker exec $envs trivy-service trivy image --server http://localhost:4954 --image-src docker --quiet --scanners vuln --format json --severity CRITICAL,HIGH,MEDIUM,LOW '$image'" 2>/dev/null)" raw="$(dockerCommandRun "docker exec trivy-service trivy image --server http://localhost:4954 --quiet --scanners vuln --format json --severity CRITICAL,HIGH,MEDIUM,LOW '$image'" 2>/dev/null)"
[ -n "$raw" ] || { echo '[]'; return; } [ -n "$raw" ] || { echo '[]'; return; }
printf '%s' "$raw" | jq -c ' printf '%s' "$raw" | jq -c '