Public Access
+3
-2
@@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [1.2.0]
|
## [1.2.0] - 2020-05-07
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Do not fail check if no critical vulnerabilities were found when executed for a fork repository (closes #104)
|
- Compatibility with latest `cargo-audit == 0.12` JSON output (#115)
|
||||||
|
- Do not fail check if no critical vulnerabilities were found when executed for a fork repository (closes #104)
|
||||||
|
|
||||||
## [1.1.0]
|
## [1.1.0]
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rust-audit-check",
|
"name": "rust-audit-check",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rust-audit-check",
|
"name": "rust-audit-check",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Security audit for security vulnerabilities",
|
"description": "Security audit for security vulnerabilities",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
|
|||||||
+3
-19
@@ -8,7 +8,7 @@ export interface Report {
|
|||||||
database: DatabaseInfo;
|
database: DatabaseInfo;
|
||||||
lockfile: LockfileInfo;
|
lockfile: LockfileInfo;
|
||||||
vulnerabilities: VulnerabilitiesInfo;
|
vulnerabilities: VulnerabilitiesInfo;
|
||||||
warnings: Warning[];
|
warnings: Warning[] | { [key: string]: Warning[] };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DatabaseInfo {
|
export interface DatabaseInfo {
|
||||||
@@ -47,23 +47,7 @@ export interface Package {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Warning {
|
export interface Warning {
|
||||||
kind: Kind;
|
kind: 'unmaintained' | 'informational' | 'yanked' | string;
|
||||||
|
advisory: Advisory;
|
||||||
package: Package;
|
package: Package;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeScript types system is weird :(
|
|
||||||
export interface Kind {
|
|
||||||
unmaintained?: KindUnmaintained;
|
|
||||||
informational?: KindInformational;
|
|
||||||
yanked?: KindYanked;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface KindUnmaintained {
|
|
||||||
advisory: Advisory;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface KindInformational {
|
|
||||||
advisory: Advisory;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface KindYanked {} // eslint-disable-line @typescript-eslint/no-empty-interface
|
|
||||||
|
|||||||
+16
-4
@@ -53,10 +53,22 @@ export async function run(actionInput: input.Input): Promise<void> {
|
|||||||
shouldReport = true;
|
shouldReport = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (report.warnings.length === 0) {
|
// In `cargo-audit < 0.12` report contained an array of `Warning`.
|
||||||
|
// In `cargo-audit >= 0.12` it is a JSON object,
|
||||||
|
// where key is a warning type, and value is an array of `Warning` of that type.
|
||||||
|
let warnings: Array<interfaces.Warning> = [];
|
||||||
|
if (Array.isArray(report.warnings)) {
|
||||||
|
warnings = report.warnings;
|
||||||
|
} else {
|
||||||
|
for (const items of Object.values(report.warnings)) {
|
||||||
|
warnings = warnings.concat(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warnings.length === 0) {
|
||||||
core.info('No warnings were found');
|
core.info('No warnings were found');
|
||||||
} else {
|
} else {
|
||||||
core.warning(`${report.warnings.length} warnings found!`);
|
core.warning(`${warnings.length} warnings found!`);
|
||||||
shouldReport = true;
|
shouldReport = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,12 +84,12 @@ export async function run(actionInput: input.Input): Promise<void> {
|
|||||||
core.debug(
|
core.debug(
|
||||||
'Action was triggered on a schedule event, creating an Issues report',
|
'Action was triggered on a schedule event, creating an Issues report',
|
||||||
);
|
);
|
||||||
await reporter.reportIssues(client, advisories, report.warnings);
|
await reporter.reportIssues(client, advisories, warnings);
|
||||||
} else {
|
} else {
|
||||||
core.debug(
|
core.debug(
|
||||||
`Action was triggered on a ${github.context.eventName} event, creating a Check report`,
|
`Action was triggered on a ${github.context.eventName} event, creating a Check report`,
|
||||||
);
|
);
|
||||||
await reporter.reportCheck(client, advisories, report.warnings);
|
await reporter.reportCheck(client, advisories, warnings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+50
-39
@@ -26,26 +26,32 @@ function makeReport(
|
|||||||
): string {
|
): string {
|
||||||
const preparedWarnings: Array<templates.ReportWarning> = [];
|
const preparedWarnings: Array<templates.ReportWarning> = [];
|
||||||
for (const warning of warnings) {
|
for (const warning of warnings) {
|
||||||
// TODO: Is there any better way?
|
switch (warning.kind) {
|
||||||
if ('unmaintained' in warning.kind) {
|
case 'unmaintained':
|
||||||
preparedWarnings.push({
|
preparedWarnings.push({
|
||||||
advisory: warning.kind.unmaintained!.advisory, // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
advisory: warning.advisory,
|
||||||
package: warning.package,
|
package: warning.package,
|
||||||
});
|
});
|
||||||
} else if ('informational' in warning.kind) {
|
break;
|
||||||
preparedWarnings.push({
|
|
||||||
advisory: warning.kind.informational!.advisory, // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
case 'informational':
|
||||||
package: warning.package,
|
preparedWarnings.push({
|
||||||
});
|
advisory: warning.advisory,
|
||||||
} else if ('yanked' in warning.kind) {
|
package: warning.package,
|
||||||
preparedWarnings.push({
|
});
|
||||||
package: warning.package,
|
break;
|
||||||
});
|
|
||||||
} else {
|
case 'yanked':
|
||||||
core.warning(
|
preparedWarnings.push({
|
||||||
`Unknown warning kind ${warning.kind} found, please, file a bug`,
|
package: warning.package,
|
||||||
);
|
});
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
core.warning(
|
||||||
|
`Unknown warning kind ${warning.kind} found, please, file a bug`,
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,11 +91,15 @@ function getStats(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const warning of warnings) {
|
for (const warning of warnings) {
|
||||||
if (warning.kind.unmaintained) {
|
switch (warning.kind) {
|
||||||
unmaintained += 1;
|
case 'unmaintained':
|
||||||
} else {
|
unmaintained += 1;
|
||||||
// Both yanked and informational types of kind
|
break;
|
||||||
other += 1;
|
|
||||||
|
default:
|
||||||
|
// Both yanked and informational types of kind
|
||||||
|
other += 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,20 +253,21 @@ export async function reportIssues(
|
|||||||
|
|
||||||
for (const warning of warnings) {
|
for (const warning of warnings) {
|
||||||
let advisory: interfaces.Advisory;
|
let advisory: interfaces.Advisory;
|
||||||
if ('unmaintained' in warning.kind) {
|
switch (warning.kind) {
|
||||||
advisory = warning.kind.unmaintained!.advisory; // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
case 'unmaintained':
|
||||||
} else if ('informational' in warning.kind) {
|
case 'informational':
|
||||||
advisory = warning.kind.informational!.advisory; // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
advisory = warning.advisory;
|
||||||
} else if ('yanked' in warning.kind) {
|
break;
|
||||||
core.warning(
|
case 'yanked':
|
||||||
`Crate ${warning.package.name} was yanked, but no issue will be reported about it`,
|
core.warning(
|
||||||
);
|
`Crate ${warning.package.name} was yanked, but no issue will be reported about it`,
|
||||||
continue;
|
);
|
||||||
} else {
|
continue;
|
||||||
core.warning(
|
default:
|
||||||
`Unknown warning kind ${warning.kind} found, please, file a bug`,
|
core.warning(
|
||||||
);
|
`Unknown warning kind ${warning.kind} found, please, file a bug`,
|
||||||
continue;
|
);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const reported = await alreadyReported(client, advisory.id);
|
const reported = await alreadyReported(client, advisory.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user