Replies: 6 comments 1 reply
-
Thanks for your suggestion. Yes, it brings breaking change and will be a big impact. We were not sure how many users needed metadata in templates, and wondering if it was worth causing confusion. Can we hold it for a while and see the demand from the community? |
Beta Was this translation helpful? Give feedback.
-
Yep! I understand, and I'm comfortable with that approach. Our primary use case is collating multiple scans of artifact bundles when scanning Helm charts for example. We can continue to do that with external tooling. Additionally, the current HTML template uses an awkward 0-index into Targets to title the report that would likely make more sense as the Artifact Name: Line 85 in 914c6f0 As I see it, nothing critical at this point requires it, but I see it getting harder and harder to make this type of change as the project matures if it is ever desired. Regardless, thanks for your consideration and the great project! |
Beta Was this translation helpful? Give feedback.
-
I am hitting a similar bump here when using templating to create a report for SonarQube. The existing template (https://github.com/mendhak/trivy-template-output-to-sonarqube) uses I patched the generated report to double-check this. Without the suffix, SonarQube accepts the report because the filename matches an existing file. The contents of My suggestion would be to add a new field in pkg/types/report.go#L71 holding the name of the artifact. |
Beta Was this translation helpful? Give feedback.
-
I've ended up here trying to include "artifactName" in my template, but it seems that this field is located in "types.Report" - Is there a fix for this? |
Beta Was this translation helpful? Give feedback.
-
Found my way here too. I was exploring trivy to replace some reports I archive for audits. I generate a report which they prefer reviewing, providing them metadata about the report is helpful making their experience auditing us positive. I'm basically using another language so I can have that meta data in the reports. |
Beta Was this translation helpful? Give feedback.
-
while I think the original request is legitimate, I just want to add that there's an alternative solution using output plugin |
Beta Was this translation helpful? Give feedback.
-
I'd like to use additional
types.Report
data in my templates, currently available only in the JSON report. In particular,ArtifactName
. It seems thattemplate.go
only renders fromResults
:trivy/pkg/report/template.go
Line 75 in 79a1ba3
while JSON takes the full data structure:
trivy/pkg/report/json.go
Line 20 in 79a1ba3
Can we change the
template.go
report to include the fulltypes.Report
data? I'd happily do the work and refactor the existingcontrib
templates. I know this would have some backward compatibility issues, so I understand if the project prefers to keep it as is. Thanks!Beta Was this translation helpful? Give feedback.
All reactions