Closed
Description
Discussed in #8726
Originally posted by creste April 11, 2025
IDs
AVD-KSV-0033
AVD-KSV-0035
Description
With this job:
apiVersion: batch/v1
kind: Job
metadata:
name: test
namespace: test
spec:
template:
spec:
containers:
- name: test
image: test.azurecr.io/test:latest
The latest version of trivy-checks
reports:
AVD-KSV-0035 (MEDIUM): Container 'test' of Job 'test' should restrict images to own ECR repository. See the full ECR list here: https://docs.aws.amazon.com/general/latest/gr/ecr.html
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Container images from non-ECR registries should be forbidden.
See https://avd.aquasec.com/misconfig/ksv035
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
kubernetes/test.yaml:10-11
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
10 ┌ - name: test
11 └ image: test.azurecr.io/test:latest
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
The job does not use ECR. It uses Azure CR instead. trivy-checks
should not report this issue for non-AWS environments.
Reproduction Steps
1. Create a `test.yaml` file containing the k8s job specified in the Description above.
2. Run `trivy config test.yaml` to scan the YAML file.
Target
Filesystem
Scanner
Misconfiguration
Target OS
No response
Debug Output
$ trivy config --debug test.yaml
2025-04-11T10:21:14-04:00 DEBUG No plugins loaded
2025-04-11T10:21:14-04:00 DEBUG Default config file "file_path=trivy.yaml" not found, using built in values
2025-04-11T10:21:14-04:00 DEBUG Cache dir dir="/home/test/.cache/trivy"
2025-04-11T10:21:14-04:00 DEBUG Cache dir dir="/home/test/.cache/trivy"
2025-04-11T10:21:14-04:00 DEBUG Parsed severities severities=[UNKNOWN LOW MEDIUM HIGH CRITICAL]
2025-04-11T10:21:14-04:00 INFO [misconfig] Misconfiguration scanning is enabled
2025-04-11T10:21:14-04:00 DEBUG [misconfig] Checks successfully loaded from disk
2025-04-11T10:21:14-04:00 DEBUG Enabling misconfiguration scanners scanners=[azure-arm cloudformation dockerfile helm kubernetes terraform terraformplan-json terraformplan-snapshot]
2025-04-11T10:21:14-04:00 DEBUG Initializing scan cache... type="memory"
2025-04-11T10:21:14-04:00 DEBUG [fs] Analyzing... root="test.yaml"
2025-04-11T10:21:14-04:00 DEBUG [fs] Random cache key will be used err="failed to open git repository: stat /home/test/test.yaml/.git: not a directory"
2025-04-11T10:21:14-04:00 DEBUG [misconfig] Scanning files for misconfigurations... scanner="Kubernetes"
2025-04-11T10:21:15-04:00 DEBUG [rego] Overriding filesystem for checks
2025-04-11T10:21:15-04:00 DEBUG [rego] Embedded libraries are loaded count=17
2025-04-11T10:21:15-04:00 DEBUG [rego] Embedded checks are loaded count=516
2025-04-11T10:21:15-04:00 DEBUG [rego] Checks from disk are loaded count=533
2025-04-11T10:21:15-04:00 DEBUG [rego] Overriding filesystem for data
2025-04-11T10:21:15-04:00 DEBUG [kubernetes scanner] Scanning files... count=1
2025-04-11T10:21:15-04:00 DEBUG [rego] Scanning inputs count=1
2025-04-11T10:21:15-04:00 DEBUG [misconfig] Scanning files for misconfigurations... scanner="Helm"
2025-04-11T10:21:15-04:00 DEBUG [rego] Overriding filesystem for checks
2025-04-11T10:21:15-04:00 DEBUG [rego] Embedded libraries are loaded count=17
2025-04-11T10:21:15-04:00 DEBUG [rego] Embedded checks are loaded count=516
2025-04-11T10:21:15-04:00 DEBUG [rego] Checks from disk are loaded count=533
2025-04-11T10:21:15-04:00 DEBUG [rego] Overriding filesystem for data
2025-04-11T10:21:15-04:00 DEBUG OS is not detected.
2025-04-11T10:21:15-04:00 INFO Detected config files num=1
2025-04-11T10:21:15-04:00 DEBUG Scanned config file file_path="test.yaml"
2025-04-11T10:21:15-04:00 DEBUG Specified ignore file does not exist file=".trivyignore"
2025-04-11T10:21:15-04:00 DEBUG [vex] VEX filtering is disabled
Report Summary
┌───────────┬────────────┬───────────────────┐
│ Target │ Type │ Misconfigurations │
├───────────┼────────────┼───────────────────┤
│ test.yaml │ kubernetes │ 20 │
└───────────┴────────────┴───────────────────┘
Legend:
- '-': Not scanned
- '0': Clean (no security findings detected)
test.yaml (kubernetes)
Tests: 100 (SUCCESSES: 80, FAILURES: 20)
Failures: 20 (UNKNOWN: 0, LOW: 12, MEDIUM: 6, HIGH: 2, CRITICAL: 0)
... SNIP ...
AVD-KSV-0035 (MEDIUM): Container 'test' of Job 'test' should restrict images to own ECR repository. See the full ECR list here: https://docs.aws.amazon.com/general/latest/gr/ecr.html
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Container images from non-ECR registries should be forbidden.
See https://avd.aquasec.com/misconfig/ksv035
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
test.yaml:10-11
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
10 ┌ - name: test
11 └ image: test.azurecr.io/test:latest
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
... SNIP ...
Version
$ trivy --version
Version: 0.61.0
Vulnerability DB:
Version: 2
UpdatedAt: 2025-03-12 12:20:38.18587118 +0000 UTC
NextUpdate: 2025-03-13 12:20:38.185870879 +0000 UTC
DownloadedAt: 2025-03-12 15:19:33.379000954 +0000 UTC
Java DB:
Version: 1
UpdatedAt: 2025-02-14 02:24:51.921228254 +0000 UTC
NextUpdate: 2025-02-17 02:24:51.921228094 +0000 UTC
DownloadedAt: 2025-02-24 21:53:33.569172442 +0000 UTC
Check Bundle:
Digest: sha256:40facaecbac0958cc77e7081820f92b9a2d8c0ce2d0310a120f3275aae046863
DownloadedAt: 2025-04-11 13:52:50.90995531 +0000 UTC
Checklist
- Read the documentation regarding wrong detection
- Ran Trivy with
-f json
that shows data sources and confirmed that the security advisory in data sources was correct
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status