Public Access
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69366f33c9 | ||
|
|
7b350a127d | ||
|
|
286a088f1c | ||
|
|
b7dc4ebf0c | ||
|
|
6dc762e804 | ||
|
|
fe0359b3e1 | ||
|
|
4da312dd0f | ||
|
|
d6805b6463 |
@@ -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 @@
|
||||
@actions-rs:registry=https://npm.pkg.github.com
|
||||
@clechasseur:registry=https://npm.pkg.github.com
|
||||
|
||||
@@ -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@v1.4.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
@@ -86,8 +86,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@v1.4.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
@@ -104,5 +104,6 @@ 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
|
||||
|
||||
+5
-1
@@ -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'
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+3
-1
File diff suppressed because one or more lines are too long
Generated
+3313
-19506
File diff suppressed because it is too large
Load Diff
+16
-20
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rust-audit-check",
|
||||
"version": "1.4.1",
|
||||
"version": "2.0.0",
|
||||
"private": false,
|
||||
"description": "Security audit for security vulnerabilities",
|
||||
"main": "lib/main.js",
|
||||
@@ -34,26 +34,22 @@
|
||||
"url": "https://github.com/actions-rs/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"
|
||||
"@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"
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/node": "^20.11.17",
|
||||
"@vercel/ncc": "0.38.1",
|
||||
"jest": "^29.7.0",
|
||||
"ts-jest": "^29.1.2",
|
||||
"typescript": "^5.3.3",
|
||||
"prettier": "^3.2.5"
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -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 }) ?? '.',
|
||||
};
|
||||
}
|
||||
|
||||
+13
-5
@@ -4,7 +4,7 @@ import * as os from 'os';
|
||||
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');
|
||||
@@ -100,7 +108,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;
|
||||
|
||||
+1
-1
@@ -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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user