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

Converting JSON report to TABLE report missing code blocks when output to console #5530

Closed
2 tasks done
DmitriyLewen opened this issue Nov 7, 2023 Discussed in #5514 · 0 comments · Fixed by #5531
Closed
2 tasks done

Converting JSON report to TABLE report missing code blocks when output to console #5530

DmitriyLewen opened this issue Nov 7, 2023 Discussed in #5514 · 0 comments · Fixed by #5531
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. scan/misconfiguration Issues relating to misconfiguration scanning

Comments

@DmitriyLewen
Copy link
Contributor

Discussed in #5514

Originally posted by codemedic November 5, 2023

Description

When converting a JSON scan report to table format, all seems fine when written to a file, by redirecting the output. But when written to console, to see it in colour, the code blocks seem missing. Only the line numbers are shown.

Desired Behavior

Similar to how the report is when redirected to a file, the console output should contain code-blocks highlighting the issue location.

Actual Behavior

No code block is present in console output.

Reproduction Steps

1. `trivy fs --scanners vuln,secret,config --format json --output report.json .`
2. `trivy convert --format table report.json > report.txt` works fine; contains the code blocks.
3. `trivy convert --format table report.json` does not print the code blocks that were present in `report.txt`

Target

Filesystem

Scanner

Misconfiguration

Output Format

Table

Mode

Standalone

Debug Output

$ trivy convert --format table report.json --debug
2023-11-04T22:59:59.771Z        DEBUG   Severities: ["UNKNOWN" "LOW" "MEDIUM" "HIGH" "CRITICAL"]
2023-11-04T22:59:59.772Z        DEBUG   Writing report to output...

Operating System

Linux

Version

$ trivy --version
Version: 0.46.1
Vulnerability DB:
  Version: 2
  UpdatedAt: 2023-11-04 18:12:03.547428952 +0000 UTC
  NextUpdate: 2023-11-05 00:12:03.547428381 +0000 UTC
  DownloadedAt: 2023-11-04 21:01:49.213622241 +0000 UTC
Policy Bundle:
  Digest: sha256:1df8ade71efc830877ca3b1130f83e0c6368e3a45b0d4c0f0418955501644054
  DownloadedAt: 2023-11-04 21:01:50.784837026 +0000 UTC

Checklist

@DmitriyLewen DmitriyLewen added kind/bug Categorizes issue or PR as related to a bug. scan/misconfiguration Issues relating to misconfiguration scanning labels Nov 7, 2023
@DmitriyLewen DmitriyLewen self-assigned this Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. scan/misconfiguration Issues relating to misconfiguration scanning
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant