15 Commits
Author SHA1 Message Date
Aaron Kelbsch d1a8548176 docs: update readme
Continuous integration / main (push) Failing after 51s
2025-08-25 15:41:05 +02:00
Aaron Kelbsch 4869f6bfcf feat: also write issues when manually triggered 2025-08-25 15:37:02 +02:00
Aaron Kelbsch b0356b9add chore: add missing dependencies to package json 2025-08-25 15:36:26 +02:00
Aaron Kelbsch 34d5211002 docs: add contribution info to readme 2025-08-25 15:32:31 +02:00
Aaron Kelbsch c5a5443df7 chore: update package.json 2025-08-25 15:32:21 +02:00
PythonGermany dd2c7de31f Update action version in README.md examples (#35) 2025-02-23 11:00:21 +01:00
Tony Arcieri 69366f33c9 Prep for v2.0.0 release (#25)
Continuous integration / main (push) Failing after 1m29s
2024-09-23 08:24:55 -06:00
Tony Arcieri 7b350a127d npm audit fix (#24) 2024-09-23 08:21:39 -06:00
Charles Lechasseur 286a088f1c fix: update @clechasseur/rs-actions-core and other dependencies (#23)
This fixes a high-severity security vulnerability in the `braces` library.
2024-07-22 13:12:29 -06:00
Ross b7dc4ebf0c Added support for working-directory (#21) 2024-07-08 10:14:45 -06:00
Tillmann 6dc762e804 update to latest upstream and rebuild (#20) 2024-05-09 19:18:11 -06:00
Charles Lechasseur fe0359b3e1 Run on Node 20.x (#16)
Also move to @clechasseur/rs-actions-core for more up-to-date dependencies
2024-04-23 16:26:03 -06:00
pinkforest 4da312dd0f docs: Update repo link 2023-04-04 19:19:38 +10:00
pinkforest d6805b6463 docs: Bump version in README 2023-04-04 18:24:42 +10:00
pinkforest(she/her) dd51754d4e Further fix unsound and notice reporting (#10) (#11)
Continuous integration / main (push) Successful in 1m55s
2023-04-04 18:16:49 +10:00
13 changed files with 3435 additions and 19564 deletions
+9 -3
View File
@@ -6,10 +6,16 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Create npm configuration
run: echo "//npm.pkg.github.com/:_authToken=${token}" >> ~/.npmrc
env:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
# octokit types problem ?
# - run: npm run lint
+1 -1
View File
@@ -1 +1 @@
@actions-rs:registry=https://npm.pkg.github.com
@clechasseur:registry=https://npm.pkg.github.com
+1 -1
View File
@@ -1 +1 @@
v16
v20
+12
View File
@@ -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
+26 -6
View File
@@ -26,8 +26,8 @@ jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: rustsec/audit-check@v1
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
```
@@ -36,7 +36,6 @@ It is recommended to add the `paths:` section into the workflow file,
as it would effectively speed up the CI pipeline, since the audit process
will not be performed if no dependencies were changed.
In case of any security advisories found, [status check](https://help.github.com/en/articles/about-status-checks)
created by this Action will be marked as "failed".\
Note that informational advisories are not affecting the check status.
@@ -60,7 +59,7 @@ github-token:
checks-reason: to create check
```
The action does not raise issues when it is not triggered from a "cron" scheduled workflow.
This action only raises issues when it's triggered from a `cron` scheduled workflow or on manual `workflow_dispatch`
When running the action as scheduled it will crate issues but e.g. in PR / push fails the action.
@@ -86,8 +85,8 @@ jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
```
@@ -104,5 +103,26 @@ For each new advisory (including informal) an issue will be created:
| ------------| -------- | ---------------------------------------------------------------------------| ------ | --------|
| `token` | ✓ | [GitHub token], usually a `${{ secrets.GITHUB_TOKEN }}` | string | |
| `ignore` | | Comma-separated list of advisory ids to ignore | string | |
| `working-directory`| | The directory of the Cargo.toml / Cargo.lock files to scan. | string | `.` |
[GitHub token]: https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
## Contribute
### Setting up npm login
This repo uses some npm packages hosted on github.
To be able to pull these you need to:
1. Under <https://github.com/settings/tokens> - create a `personal access token (classic)` with `read:packages` scope
2. Authenticate to the github npm registry
```sh
npm login --scope=@clechasseur --auth-type=legacy --registry=https://npm.pkg.github.com
```
```txt
Username = Github Username
Password = Token
```
+5 -1
View File
@@ -11,7 +11,11 @@ inputs:
ignore:
description: Comma-separated list of advisory ids to ignore
required: false
working-directory:
description: The directory of the Cargo.toml / Cargo.lock files to scan.
required: false
default: .
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
BIN
View File
Binary file not shown.
+3 -1
View File
File diff suppressed because one or more lines are too long
+3304 -19501
View File
File diff suppressed because it is too large Load Diff
+20 -22
View File
@@ -1,6 +1,6 @@
{
"name": "rust-audit-check",
"version": "1.3.2",
"version": "2.0.0",
"private": false,
"description": "Security audit for security vulnerabilities",
"main": "lib/main.js",
@@ -18,7 +18,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions-rs/audit.git"
"url": "github:rustsec/audit-check"
},
"keywords": [
"actions",
@@ -31,29 +31,27 @@
"author": "actions-rs",
"license": "MIT",
"bugs": {
"url": "https://github.com/actions-rs/audit-check/issues"
"url": "https://github.com/rustsec/audit-check/issues"
},
"dependencies": {
"@rinse-repeat/actions-rs-core": "0.1.8",
"@actions/core": "^1.2.6",
"@actions/github": "^5.1.0",
"npm-check-updates": "^16.8.0",
"nunjucks": "^3.2.3"
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.1",
"@clechasseur/rs-actions-core": "^3.0.5",
"nunjucks": "^3.2.4"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.56.0",
"ts-node": "^10.9.1",
"@typescript-eslint/parser": "^5.56.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"@types/jest": "^26.0.1",
"@types/node": "^16.11.7",
"@vincentriemer/ncc": "^0.20.5",
"jest": "^26.0.1",
"jest-circus": "^26.0.1",
"ts-jest": "^26.0.1",
"typescript": "^3.8.3",
"prettier": "^2.0.5"
"@types/jest": "^29.5.12",
"@types/node": "^20.11.17",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vercel/ncc": "0.38.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
}
+4 -3
View File
@@ -2,18 +2,19 @@
* Parse action input into a some proper thing.
*/
import { input } from '@rinse-repeat/actions-rs-core';
import { getInputList } from '@rinse-repeat/actions-rs-core/dist/input';
import { input } from '@clechasseur/rs-actions-core';
// Parsed action input
export interface Input {
token: string;
ignore: string[];
workingDirectory: string;
}
export function get(): Input {
return {
token: input.getInput('token', { required: true }),
ignore: getInputList('ignore', { required: false }),
ignore: input.getInputList('ignore', { required: false }),
workingDirectory: input.getInput('working-directory', { required: false }) ?? '.',
};
}
+18 -7
View File
@@ -1,10 +1,10 @@
import * as process from 'process';
import * as os from 'os';
import * as process from 'process';
import * as core from '@actions/core';
import * as github from '@actions/github';
import { Cargo } from '@rinse-repeat/actions-rs-core';
import { Cargo } from '@clechasseur/rs-actions-core';
import * as input from './input';
import * as interfaces from './interfaces';
@@ -12,12 +12,11 @@ import * as reporter from './reporter';
async function getData(
ignore: string[] | undefined,
workingDirectory: string,
): Promise<interfaces.Report> {
const cargo = await Cargo.get();
await cargo.findOrInstall('cargo-audit');
await cargo.call(['generate-lockfile']);
let stdout = '';
try {
core.startGroup('Calling cargo-audit (JSON output)');
@@ -26,6 +25,7 @@ async function getData(
commandArray.push('--ignore', item);
}
commandArray.push('--json');
commandArray.push('--file', `${workingDirectory}/Cargo.lock`);
await cargo.call(commandArray, {
ignoreReturnCode: true,
listeners: {
@@ -46,9 +46,17 @@ async function getData(
return JSON.parse(stdout);
}
function removeTrailingSlash(str) {
if (str[str.length - 1] === '/') {
return str.substr(0, str.length - 1);
}
return str;
}
export async function run(actionInput: input.Input): Promise<void> {
const ignore = actionInput.ignore;
const report = await getData(ignore);
const workingDirectory = removeTrailingSlash(actionInput.workingDirectory);
const report = await getData(ignore, workingDirectory);
let shouldReport = false;
if (!report.vulnerabilities.found) {
core.info('No vulnerabilities were found');
@@ -82,7 +90,10 @@ export async function run(actionInput: input.Input): Promise<void> {
// const octokit = github.getOctokit(actionInput.token, {userAgent: USER_AGENT});
const advisories = report.vulnerabilities.list;
if (github.context.eventName == 'schedule') {
if (
github.context.eventName == 'schedule' ||
github.context.eventName == 'workflow_dispatch'
) {
core.debug(
'Action was triggered on a schedule event, creating an Issues report',
);
@@ -100,7 +111,7 @@ async function main(): Promise<void> {
const actionInput = input.get();
await run(actionInput);
} catch (error) {
core.setFailed(error.message);
core.setFailed((error as Error).message);
}
return;
+17 -3
View File
@@ -4,7 +4,7 @@ import * as core from '@actions/core';
import * as github from '@actions/github';
import * as nunjucks from 'nunjucks';
import { checks } from '@rinse-repeat/actions-rs-core';
import { checks } from '@clechasseur/rs-actions-core';
import * as interfaces from './interfaces';
import * as templates from './templates';
@@ -15,6 +15,7 @@ interface Stats {
critical: number;
notices: number;
unmaintained: number;
unsound: number;
other: number;
}
@@ -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) {
@@ -98,6 +100,9 @@ function getStats(
case 'unmaintained':
unmaintained += 1;
break;
case 'unsound':
unsound += 1;
break;
case null:
critical += 1;
break;
@@ -113,6 +118,10 @@ function getStats(
unmaintained += 1;
break;
case 'unsound':
unsound += 1;
break;
default:
// Both yanked and informational types of kind
other += 1;
@@ -124,6 +133,7 @@ function getStats(
critical: critical,
notices: notices,
unmaintained: unmaintained,
unsound: unsound,
other: other,
};
}
@@ -132,8 +142,7 @@ 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)}`);
@@ -141,6 +150,9 @@ function getSummary(stats: Stats): string {
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`);
}
@@ -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;