Skip to content
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.1] - 2023-04-04

### Fixed

- Corrected reporting on `unsound` and `notice` informationals

## [1.4.0] - 2023-04-04

### Fixed

- Reflect change to enable warning on `unsound` and `notice` informationals

## [1.3.2] - 2023-03-13

### Changed
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rust-audit-check",
"version": "1.3.2",
"version": "1.4.1",
"private": false,
"description": "Security audit for security vulnerabilities",
"main": "lib/main.js",
Expand Down
18 changes: 16 additions & 2 deletions src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface Stats {
critical: number;
notices: number;
unmaintained: number;
unsound: number;
other: number;
}

Expand Down Expand Up @@ -89,6 +90,7 @@ function getStats(
let critical = 0;
let notices = 0;
let unmaintained = 0;
let unsound = 0;
let other = 0;
for (const vulnerability of vulnerabilities) {
switch (vulnerability.advisory.informational) {
Expand All @@ -98,6 +100,9 @@ function getStats(
case 'unmaintained':
unmaintained += 1;
break;
case 'unsound':
unsound += 1;
break;
case null:
critical += 1;
break;
Expand All @@ -113,6 +118,10 @@ function getStats(
unmaintained += 1;
break;

case 'unsound':
unsound += 1;
break;

default:
// Both yanked and informational types of kind
other += 1;
Expand All @@ -124,6 +133,7 @@ function getStats(
critical: critical,
notices: notices,
unmaintained: unmaintained,
unsound: unsound,
other: other,
};
}
Expand All @@ -132,15 +142,17 @@ function getSummary(stats: Stats): string {
const blocks: string[] = [];

if (stats.critical > 0) {
// TODO: Plural
blocks.push(`${stats.critical} advisory(ies)`);
blocks.push(`${stats.critical} advisories`);
}
if (stats.notices > 0) {
blocks.push(`${stats.notices} notice${plural(stats.notices)}`);
}
if (stats.unmaintained > 0) {
blocks.push(`${stats.unmaintained} unmaintained`);
}
if (stats.unsound > 0) {
blocks.push(`${stats.unsound} unsound`);
}
if (stats.other > 0) {
blocks.push(`${stats.other} other`);
}
Expand Down Expand Up @@ -275,6 +287,8 @@ export async function reportIssues(
for (const warning of warnings) {
let advisory: interfaces.Advisory;
switch (warning.kind) {
case 'unsound':
case 'notice':
case 'unmaintained':
case 'informational':
advisory = warning.advisory;
Expand Down