mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-18 16:22:33 +01:00
Add support for logging remediation measures in JSON format
This commit is contained in:
parent
8e0daa11de
commit
c3511209f9
1 changed files with 8 additions and 0 deletions
|
@ -93,4 +93,12 @@ resulttestjson() {
|
||||||
itemsJson=$(printf "["; ISEP=""; ITEMCOUNT=0; for item in $truncItems; do printf "%s\"%s\"" "$ISEP" "$item"; ISEP=","; done; printf "]")
|
itemsJson=$(printf "["; ISEP=""; ITEMCOUNT=0; for item in $truncItems; do printf "%s\"%s\"" "$ISEP" "$item"; ISEP=","; done; printf "]")
|
||||||
printf "\"result\": \"%s\", \"details\": \"%s: %s\", \"items\": %s}" "$1" "$2" "$truncItems" "$itemsJson" | tee -a "$logger.json" 2>/dev/null 1>&2
|
printf "\"result\": \"%s\", \"details\": \"%s: %s\", \"items\": %s}" "$1" "$2" "$truncItems" "$itemsJson" | tee -a "$logger.json" 2>/dev/null 1>&2
|
||||||
fi
|
fi
|
||||||
|
# Log remediation measure
|
||||||
|
if [ ! -z "$remediation" ]; then
|
||||||
|
printf ", \"remediation\": \"%s\"" "$remediation" | tee -a "$logger.json" 2>/dev/null 1>&2
|
||||||
|
if [ ! -z "$remediationImpact" ]; then
|
||||||
|
printf ", \"remediation-impact\": \"%s\"" "$remediationImpact" | tee -a "$logger.json" 2>/dev/null 1>&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
printf "}" | tee -a "$logger.json" 2>/dev/null 1>&2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue