fatihtokus / scan2html

A Trivy plugin that scans and outputs the results (vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more) to an interactive html file.
Apache License 2.0
28 stars 4 forks source link

Scan2html k8s display fails #25

Closed korallo159 closed 3 months ago

korallo159 commented 4 months ago

trivy scan2html k8s --report=all all -n my-namespace resultnew.html

Json is inside html, but page is empty (no vulnerabilities) only filters and search bar.

Uncaught TypeError: Cannot read properties of undefined (reading 'forEach') at vulnerabilitiesForK8s (result3.html:470:32) at vulnerabilities (result3.html:465:12) at initializeReportTitle (result3.html:410:89) at initTheReportDetails (result3.html:383:5) at result3.html:13248:1

fatihtokus commented 4 months ago

Hi @korallo159 ,

Thank you for reporting the issue. I will quickly investigate and revert back to you.

Regards, Fatih

fatihtokus commented 4 months ago

Can you use this command 'trivy scan2html k8s --report=all all -n my-namespace --format json -o results.json resultnew.html'? (ref: https://aquasecurity.github.io/trivy/v0.49/docs/target/kubernetes/) And which version of scan2html (trivy scan2html -h) and which version of trivy? Also can you check the if you are getting a json like below? { "ClusterName": "minikube", "Vulnerabilities": [ { "Namespace": "default", "Kind": "Deployment", "Name": "app", "Results": [ { "Target": "ubuntu:latest (ubuntu 22.04)", "Class": "os-pkgs", "Type": "ubuntu", "Vulnerabilities": [ { "VulnerabilityID": "CVE-111-111", .....

korallo159 commented 4 months ago

` scan2html v0.2.2

Usage: trivy scan2html [-h,--help] command target filename`

The json output looks different, I use latest trivy version.

{ "ClusterName": "", "Resources": [ { "Namespace": "", "Kind": "ServiceAccount", "Name": "default", "Metadata": { "ImageConfig": { "architecture": "", "created": "0001-01-01T00:00:00Z", "os": "", "rootfs": { "type": "", "diff_ids": null }, "config": {} } }, "Results": [ { "Target": "ServiceAccount/default", "Class": "config", "Type": "kubernetes", "MisconfSummary": { "Successes": 102, "Failures": 0, "Exceptions": 0 } } ] }, { ....

fatihtokus commented 3 months ago

Thanks for the reply @korallo159 , I am still investigating this issue. Please, could you try this command 'trivy scan2html k8s --report=all all -n my-namespace --format json -o results.json resultnew.html' and see if the result changes

fatihtokus commented 3 months ago

Hi @korallo159 ,

Thanks for your patience. I have fixed your issue with the latest release(v0.2.4). Please follow these steps:

Note: the command($trivy scan2html k8s --report=all all -n my-namespace resultnew.html) you use is creating a summary of the result which is not suitable for scan2html at the moment. But if you think that would be useful, we can support that as well, please let us know. image

Regards, Fatih

korallo159 commented 3 months ago

Hi, I generated and I confirm that I see contents now I think it would be nice to have also summary in html. Thank you

fatihtokus commented 3 months ago

Hi @korallo159 ,

I am glad to hear that your issue has been addressed. I have created a separated issue for the summary feature and closing this. Could you please give us a star for support?

Regards, Fatih