Public Access
feat: adds support for ignores (#1)
* feat: adding optional ignore list * chore: updating lock file * format: prettier tak * chore: new build * chore: adding nvm rc to avoid error with vercel and node v17 * chore: bumping version to 1.3.0 * fix: gh actions does not support sequences as input * chore: refresh build * refactor: use getInputList from actos-rs/core * add ignore to action.yml Co-authored-by: moliva <oliva.miguelh@gmail.com>
This commit is contained in:
co-authored by
moliva
parent
35b7b53b1e
commit
bb800784d9
@@ -8,6 +8,9 @@ inputs:
|
||||
token:
|
||||
description: GitHub Actions token
|
||||
required: true
|
||||
ignore:
|
||||
description: Comma-separated list of advisory ids to ignore
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'node12'
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Generated
+22873
-9993
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rust-audit-check",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.1",
|
||||
"private": false,
|
||||
"description": "Security audit for security vulnerabilities",
|
||||
"main": "lib/main.js",
|
||||
|
||||
@@ -3,14 +3,17 @@
|
||||
*/
|
||||
|
||||
import { input } from '@actions-rs/core';
|
||||
import { getInputList } from '@actions-rs/core/dist/input';
|
||||
|
||||
// Parsed action input
|
||||
export interface Input {
|
||||
token: string;
|
||||
ignore: string[];
|
||||
}
|
||||
|
||||
export function get(): Input {
|
||||
return {
|
||||
token: input.getInput('token', { required: true }),
|
||||
ignore: getInputList('ignore', { required: false }),
|
||||
};
|
||||
}
|
||||
|
||||
+11
-3
@@ -14,7 +14,9 @@ const pkg = require('../package.json'); // eslint-disable-line @typescript-eslin
|
||||
|
||||
const USER_AGENT = `${pkg.name}/${pkg.version} (${pkg.bugs.url})`;
|
||||
|
||||
async function getData(): Promise<interfaces.Report> {
|
||||
async function getData(
|
||||
ignore: string[] | undefined,
|
||||
): Promise<interfaces.Report> {
|
||||
const cargo = await Cargo.get();
|
||||
await cargo.findOrInstall('cargo-audit');
|
||||
|
||||
@@ -23,7 +25,12 @@ async function getData(): Promise<interfaces.Report> {
|
||||
let stdout = '';
|
||||
try {
|
||||
core.startGroup('Calling cargo-audit (JSON output)');
|
||||
await cargo.call(['audit', '--json'], {
|
||||
const commandArray = ['audit'];
|
||||
for (const item of ignore ?? []) {
|
||||
commandArray.push('--ignore', item);
|
||||
}
|
||||
commandArray.push('--json');
|
||||
await cargo.call(commandArray, {
|
||||
ignoreReturnCode: true,
|
||||
listeners: {
|
||||
stdout: (buffer) => {
|
||||
@@ -44,7 +51,8 @@ async function getData(): Promise<interfaces.Report> {
|
||||
}
|
||||
|
||||
export async function run(actionInput: input.Input): Promise<void> {
|
||||
const report = await getData();
|
||||
const ignore = actionInput.ignore;
|
||||
const report = await getData(ignore);
|
||||
let shouldReport = false;
|
||||
if (!report.vulnerabilities.found) {
|
||||
core.info('No vulnerabilities were found');
|
||||
|
||||
Reference in New Issue
Block a user