Skip to content

Commit

Permalink
feat - Added PublishedDate, LastModifiedDate and Description to Vulne…
Browse files Browse the repository at this point in the history
…rabilit… (#119)

* Added PublishedDate, LastModifiedDate and Description to Vulnerabilities table

* new version
  • Loading branch information
fatihtokus authored Nov 10, 2024
1 parent 6c3654e commit 0ab0ea3
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 6 deletions.
6 changes: 3 additions & 3 deletions plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "scan2html"
version: "0.3.7"
version: "0.3.8"
maintainer: fatihtokus
repository: github.com/fatihtokus/scan2html
summary: A Trivy plugin that scans and outputs the results to a single page app.
Expand All @@ -10,8 +10,8 @@ description: |-
platforms:
- selector:
os: windows
uri: https://github.com/fatihtokus/scan2html/releases/download/v0.3.7/scan2html.tar.gz
uri: https://github.com/fatihtokus/scan2html/releases/download/v0.3.8/scan2html.tar.gz
bin: ./scan2html.sh
-
uri: https://github.com/fatihtokus/scan2html/releases/download/v0.3.7/scan2html.tar.gz
uri: https://github.com/fatihtokus/scan2html/releases/download/v0.3.8/scan2html.tar.gz
bin: ./scan2html.sh
10 changes: 10 additions & 0 deletions src/frontend-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/frontend-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"antd": "^5.12.6",
"moment": "^2.30.1",
"papaparse": "^5.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend-app/src/components/shared/TableTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const TableTitle = ({ title = "Trivy Report" }) => {
<Title level={3}>{title}</Title>
<div style={{ display: "flex", alignItems: "center", paddingTop: "1.25rem" }}>
<Link href={href} target="_blank">
via scan2html(v0.3.7)
via scan2html(v0.3.8)
</Link>
<Link href={href} target="_blank">
<GithubOutlined style={{ fontSize: "1.5em", marginLeft: "0.5em" }} />
Expand Down
30 changes: 28 additions & 2 deletions src/frontend-app/src/components/trivy-report/Vulnerabilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { filterDropdown, localeCompare, severityCompare, numberCompare } from '.
import SeverityTag from '../shared/SeverityTag';
import { severityFilters } from '../../constants';
import SeverityToolbar from '../shared/SeverityToolbar';
import moment from 'moment';

interface VulnerabilitiesProps {
result: NormalizedResultForDataTable[];
Expand Down Expand Up @@ -176,8 +177,8 @@ const Vulnerabilities: React.FC<VulnerabilitiesProps> = ({ result }) => {
...getColumnSearchProps('InstalledVersion'),
sorter: (a: NormalizedResultForDataTable, b: NormalizedResultForDataTable) => localeCompare(a.InstalledVersion, b.InstalledVersion),
sortDirections: ['descend', 'ascend'],
render:(text, record)=> (
<span title={record.PkgPath ? 'Path: ' + record.PkgPath : ''}>{text} </span>
render:(InstalledVersion, record)=> (
<span title={record.PkgPath ? 'Path: ' + record.PkgPath : ''}>{InstalledVersion} </span>
),
},
{
Expand All @@ -198,6 +199,30 @@ const Vulnerabilities: React.FC<VulnerabilitiesProps> = ({ result }) => {
sorter: (a: NormalizedResultForDataTable, b: NormalizedResultForDataTable) => localeCompare(a.Title, b.Title),
sortDirections: ['descend', 'ascend'],
},
{
title: 'Published Date',
dataIndex: 'PublishedDate',
key: 'PublishedDate',
width: '5%',
...getColumnSearchProps('PublishedDate'),
sorter: (a: NormalizedResultForDataTable, b: NormalizedResultForDataTable) => localeCompare(a.PublishedDate, b.PublishedDate),
sortDirections: ['descend', 'ascend'],
render:(PublishedDate)=> (
moment(PublishedDate).format('YYYY-MM-DD')
),
},
{
title: 'LastModified Date',
dataIndex: 'LastModifiedDate',
key: 'LastModifiedDate',
width: '5%',
...getColumnSearchProps('LastModifiedDate'),
sorter: (a: NormalizedResultForDataTable, b: NormalizedResultForDataTable) => localeCompare(a.LastModifiedDate, b.LastModifiedDate),
sortDirections: ['descend', 'ascend'],
render:(LastModifiedDate)=> (
moment(LastModifiedDate).format('YYYY-MM-DD')
),
},
];

const handleExpand = (expanded: boolean, record: NormalizedResultForDataTable) => {
Expand All @@ -220,6 +245,7 @@ const Vulnerabilities: React.FC<VulnerabilitiesProps> = ({ result }) => {
expandable={{
expandedRowRender: (vulnerability) => (
<div style={{ margin: 0 }}>
<strong>Description:</strong> {vulnerability.Description}
<p><strong>References:</strong></p>
<ul>
{vulnerability.References?.map((ref, index) => (
Expand Down
2 changes: 2 additions & 0 deletions src/frontend-app/src/types/external/defaultResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export type Vulnerability = {
Description: string;
References: string[];
CVSS: CVSS;
PublishedDate: string;
LastModifiedDate: string;
};

type CVSS = {
Expand Down
3 changes: 3 additions & 0 deletions src/frontend-app/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export class NormalizedResultForDataTable {

// Vulnerability
References?: string[];
PublishedDate?: string;
LastModifiedDate?: string;
Description?: string;

// Secrets
Category?: string;
Expand Down
3 changes: 3 additions & 0 deletions src/frontend-app/src/utils/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ function mapVulnerabilityResults(results: CommonResult[]): NormalizedResultForDa
FixedVersion: vulnerability.FixedVersion,
Title: vulnerability.Title,
References: vulnerability.References,
PublishedDate: vulnerability.PublishedDate,
LastModifiedDate: vulnerability.LastModifiedDate,
Description: vulnerability.Description,
IsVulnerability: true,
} as NormalizedResultForDataTable);
});
Expand Down

0 comments on commit 0ab0ea3

Please sign in to comment.