Skip to content

update existing issue #62

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

Merged
merged 8 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ If vulnerabilities are found by Trivy, it creates the following GitHub Issue.
|issue_title|False|Security Alert|Issue title|
|issue_label|False|trivy,vulnerability|Issue label (separated by commma)|
|issue_assignee|False|N/A|Issue assignee (separated by commma)|
|fail_on_vulnerabilities|False|false|Whether the action should fail if any vulnerabilities were found.|

### Outputs

Expand Down
9 changes: 6 additions & 3 deletions __tests__/trivy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('getDownloadUrl', () => {
const os = 'Linux';
const result = await downloader['getDownloadUrl'](version, os);
expect(result).toMatch(
/releases\/download\/v[0-9]\.[0-9]\.[0-9]\/trivy_[0-9]\.[0-9]\.[0-9]_Linux-64bit\.tar\.gz$/
/releases\/download\/v[0-9]+\.[0-9]+\.[0-9]+\/trivy_[0-9]+\.[0-9]+\.[0-9]+_Linux-64bit\.tar\.gz$/
);
});

Expand Down Expand Up @@ -198,14 +198,16 @@ describe('Trivy scan', () => {
});

describe('Parse', () => {
const image: string = 'alpine:3.10';

test('the result without vulnerabilities', () => {
const vulnerabilities: Vulnerability[] = [
{
Target: 'alpine:3.10 (alpine 3.10.3)',
Vulnerabilities: null,
},
];
const result = trivy.parse(vulnerabilities);
const result = trivy.parse(image, vulnerabilities);
expect(result).toBe('');
});

Expand Down Expand Up @@ -248,10 +250,11 @@ describe('Parse', () => {
],
},
];
const result = trivy.parse(vulnerabilities);
const result = trivy.parse(image, vulnerabilities);
expect(result).toMatch(
/\|Title\|Severity\|CVE\|Package Name\|Installed Version\|Fixed Version\|References\|/
);
expect(result).toContain(image);
});
});

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ inputs:
issue_assignee:
description: 'Issue assignee (separated by commma)'
required: false
fail_on_vulnerabilities:
description: Whether the action should fail if a vulnerability was found
default: 'false'
required: false

outputs:
issue_number:
Expand Down
Loading