Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(logging): Add warning in case missing config file #7028

Closed
1 of 2 tasks
simar7 opened this issue Jun 26, 2024 Discussed in #7025 · 0 comments · Fixed by #7154
Closed
1 of 2 tasks

feat(logging): Add warning in case missing config file #7028

simar7 opened this issue Jun 26, 2024 Discussed in #7025 · 0 comments · Fixed by #7154
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@simar7
Copy link
Member

simar7 commented Jun 26, 2024

Discussed in #7025

Originally posted by rkm June 26, 2024

Description

Trivy does not produce any error or warning when --config specifies a file that does not exist.

Desired Behavior

Trivy should error when the specified config file is missing since this can contain settings which affect the scan output.

Actual Behavior

The config is silently ignored and the scan proceeds normally.

Reproduction Steps

  1. Run Trivy and observe the output:
    docker run \
      --rm \
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v $HOME/.cache/trivy:/root/.cache \
      -v "$(pwd)":/repo \
      ghcr.io/aquasecurity/trivy:0.52.2 \
        image \
        --config /repo/not-a-file \
        --debug \
        debian:12-slim

Target

Container Image

Scanner

Vulnerability

Output Format

Table

Mode

Standalone

Debug Output

2024-06-26T14:51:32Z    DEBUG   Parsed severities       severities=[UNKNOWN LOW MEDIUM HIGH CRITICAL]                                                                                                                                                                                   2024-06-26T14:51:32Z    DEBUG   Ignore statuses statuses=[]
2024-06-26T14:51:32Z    DEBUG   Cache dir       dir="/root/.cache/trivy"
2024-06-26T14:51:32Z    DEBUG   DB update was skipped because the local DB is the latest
2024-06-26T14:51:32Z    DEBUG   DB info schema=2 updated_at=2024-06-26T12:13:29.845304436Z next_update=2024-06-26T18:13:29.845304285Z downloaded_at=2024-06-26T14:40:58.687229989Z                                                                                                      2024-06-26T14:51:32Z    INFO    Vulnerability scanning is enabled
2024-06-26T14:51:32Z    DEBUG   Vulnerability type      type=[os library]
2024-06-26T14:51:32Z    INFO    Secret scanning is enabled
2024-06-26T14:51:32Z    INFO    If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-06-26T14:51:32Z    INFO    Please see also https://aquasecurity.github.io/trivy/v0.52/docs/scanner/secret/#recommendation for faster secret detection                                                                                                                              2024-06-26T14:51:32Z    DEBUG   Enabling misconfiguration scanners      scanners=[azure-arm cloudformation dockerfile helm kubernetes terraform terraformplan-json terraformplan-snapshot]                                                                                              2024-06-26T14:51:33Z    DEBUG   [secret] No secret config detected      config_path="trivy-secret.yaml"
2024-06-26T14:51:33Z    DEBUG   [nuget] The nuget packages directory couldn't be found. License search disabled
2024-06-26T14:51:33Z    DEBUG   [secret] No secret config detected      config_path="trivy-secret.yaml"
2024-06-26T14:51:34Z    DEBUG   [image] Detected image ID       image_id="sha256:46a63b82e4145c5eb93ce87cb6b3e6eeb89a4318b848b8e44a2ea029ccfdc157"                                                                                                                                      2024-06-26T14:51:34Z    DEBUG   [image] Detected diff ID        diff_ids=[sha256:1387079e86adf524e7e92bada71d261d9ff58f34409751ab36560385262a8386]                                                                                                                                      2024-06-26T14:51:34Z    DEBUG   [image] Detected base layers    diff_ids=[]
2024-06-26T14:51:34Z    INFO    Detected OS     family="debian" version="12.5"
2024-06-26T14:51:34Z    INFO    [debian] Detecting vulnerabilities...   os_version="12" pkg_num=88
2024-06-26T14:51:34Z    INFO    Number of language-specific files       num=0

debian:12-slim (debian 12.5)
...

Operating System

Rocky Linux 9.4

Version

0.52.2

Checklist

@simar7 simar7 added kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant