fix(ci): resolve security findings and improve Trivy reporting

This commit is contained in:
TakuyaYagam1 committed 2026-10-05 17:30:21 +03:00
1 parent 138666a7bb
commit e9f56a6aa2
9 files changed
+110 -12

No files matched your search

+13 -1
View File
@@ -49,6 +49,12 @@ filesystem: | $(REPORTS) $(CACHE) ## Scan dependency manifests and infrastructur
@rm -f "$(REPORTS)/trivy-filesystem.json" "$(REPORTS)/trivy-version.txt"
@cd "$(ROOT)"; status=0; \
$(TRIVY) fs --config security/trivy/filesystem.yml --cache-dir "$(CACHE)/trivy" --output "$(REPORTS)/trivy-filesystem.json" . || status=$$?; \
if [ -f "$(REPORTS)/trivy-filesystem.json" ]; then \
$(TRIVY) convert --format table --scanners vuln,misconfig "$(REPORTS)/trivy-filesystem.json" || { if [ "$$status" -eq 0 ]; then status=1; fi; }; \
else \
echo 'Trivy did not create the filesystem report.' >&2; \
if [ "$$status" -eq 0 ]; then status=1; fi; \
fi; \
$(TRIVY) --cache-dir "$(CACHE)/trivy" --version > "$(REPORTS)/trivy-version.txt" || status=1; \
exit "$$status"
@@ -88,7 +94,13 @@ images: | $(REPORTS) $(CACHE) ## Build and scan the exact backend, frontend, and
if $(DOCKER) build --pull -f "$(ROOT)/$$service/Dockerfile" -t "$$tag" "$$context"; then \
if image_id=$$($(DOCKER) image inspect --format '{{.Id}}' "$$tag"); then \
printf '%s\n' "$$image_id" > "$(REPORTS)/$$service-image-id.txt"; \
$(TRIVY) image --image-src docker --config trivy/image.yml --cache-dir "$(CACHE)/trivy" --output "$(REPORTS)/trivy-$$service.json" "$$image_id" || status=1; \
report="$(REPORTS)/trivy-$$service.json"; \
$(TRIVY) image --image-src docker --config trivy/image.yml --cache-dir "$(CACHE)/trivy" --output "$$report" "$$image_id" || status=1; \
if [ -f "$$report" ]; then \
$(TRIVY) convert --format table --scanners vuln,misconfig "$$report" || status=1; \
else \
printf 'Trivy did not create the %s image report.\n' "$$service" >&2; status=1; \
fi; \
else status=1; fi; \
else status=1; fi; \
done; \