mirror of
https://github.com/actions-rust-lang/audit.git
synced 2025-12-27 01:43:48 -05:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50559e3f2c | ||
|
|
27b62ea8ec | ||
|
|
e207bcd5c9 | ||
|
|
7d76eb83b1 | ||
|
|
3e63858e0b | ||
|
|
5308f89d29 | ||
|
|
65c5146921 | ||
|
|
6e072ef47a | ||
|
|
8001bc456e | ||
|
|
cbfe81d58f | ||
|
|
89b10d9af6 | ||
|
|
61ccdfe0c5 | ||
|
|
959eb6cc5c | ||
|
|
96eb2dcbe4 | ||
|
|
6943412b48 | ||
|
|
9c29543ade | ||
|
|
dd7ccfd1ab | ||
|
|
70c2c66eb8 | ||
|
|
dfa1ce2e0a | ||
|
|
0c92230a3a | ||
|
|
170a3db2a9 | ||
|
|
656c0afdef | ||
|
|
ff8437a517 | ||
|
|
8d10929ca1 | ||
|
|
e46b8c0d76 | ||
|
|
7b3777bcef | ||
|
|
2ed876b7ce | ||
|
|
69f891a4a1 | ||
|
|
d5ad8c50af | ||
|
|
681351af46 | ||
|
|
d974e8cc12 | ||
|
|
211345ef5d |
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.10.1
|
||||
rev: 24.1.1
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
@@ -14,7 +14,7 @@ repos:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
rev: 5.13.2
|
||||
# https://github.com/psf/black/blob/main/docs/guides/using_black_with_other_tools.md
|
||||
hooks:
|
||||
- id: isort
|
||||
@@ -25,13 +25,13 @@ repos:
|
||||
- id: pyupgrade
|
||||
args: ["--py37-plus"]
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.6.1
|
||||
rev: v1.8.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies:
|
||||
- types-requests
|
||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||
rev: 0.27.0
|
||||
rev: 0.28.0
|
||||
hooks:
|
||||
- id: check-dependabot
|
||||
- id: check-github-actions
|
||||
|
||||
17
CHANGELOG.md
17
CHANGELOG.md
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.1.14] - 2024-02-18
|
||||
|
||||
* Update `cargo-audit` to 0.20.0
|
||||
|
||||
## [1.1.13] - 2024-02-03
|
||||
|
||||
* Update `cargo-audit` to 0.19.0
|
||||
|
||||
## [1.1.12] - 2024-01-20
|
||||
|
||||
* Fix default of `file` argument to make it work again for repositories without `Cargo.lock` checked in.
|
||||
|
||||
## [1.1.11] - 2024-01-18
|
||||
|
||||
* Allow specifying the path to the `Cargo.lock` file, in case it is not in the root of the repository (#55)
|
||||
* Update the example in the readme, to have the correct permissions for private repositories.
|
||||
|
||||
## [1.1.10] - 2023-11-02
|
||||
|
||||
* Fix running the action, by using the correct version of the cache action.
|
||||
|
||||
@@ -26,12 +26,11 @@ on:
|
||||
# Run manually
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
audit:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -54,6 +53,7 @@ Setting `denyWarnings` to true will also enable these warnings, but each warning
|
||||
| -------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| `TOKEN` | The GitHub access token to allow us to retrieve, create and update issues (automatically set). | `github.token` |
|
||||
| `denyWarnings` | Any warnings generated will be treated as an error and fail the action. | false |
|
||||
| `file` | The path to the Cargo.lock file. | |
|
||||
| `ignore` | A comma separated list of Rustsec IDs to ignore. | |
|
||||
| `createIssues` | Create/Update issues for each found vulnerability. By default only on `main` or `master` branch. | `github.ref == 'refs/heads/master' \|\| github.ref == 'refs/heads/main'` |
|
||||
|
||||
|
||||
11
action.yml
11
action.yml
@@ -14,6 +14,10 @@ inputs:
|
||||
description: "Any warnings generated will be treated as an error and fail the action"
|
||||
required: false
|
||||
default: "false"
|
||||
file:
|
||||
description: "Cargo lockfile to inspect"
|
||||
required: false
|
||||
default: ""
|
||||
ignore:
|
||||
description: "A comma separated list of Rustsec IDs to ignore"
|
||||
required: false
|
||||
@@ -30,19 +34,19 @@ runs:
|
||||
run: echo "cargohome=${CARGO_HOME:-$HOME/.cargo}" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
id: cargo-home
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
path: |
|
||||
${{ steps.cargo-home.outputs.cargohome }}/bin/cargo-audit*
|
||||
${{ steps.cargo-home.outputs.cargohome }}/.crates.toml
|
||||
${{ steps.cargo-home.outputs.cargohome }}/.crates2.json
|
||||
key: cargo-audit-v0.18.3
|
||||
key: cargo-audit-v0.20.0
|
||||
|
||||
- name: Install cargo-audit
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
# Update both this version number and the cache key
|
||||
run: cargo install cargo-audit --vers 0.18.3 --no-default-features
|
||||
run: cargo install cargo-audit --vers 0.20.0 --no-default-features
|
||||
shell: bash
|
||||
|
||||
- run: |
|
||||
@@ -52,6 +56,7 @@ runs:
|
||||
env:
|
||||
INPUT_CREATE_ISSUES: ${{ inputs.createIssues }}
|
||||
INPUT_DENY_WARNINGS: ${{ inputs.denyWarnings }}
|
||||
INPUT_FILE: ${{ inputs.file }}
|
||||
INPUT_IGNORE: ${{ inputs.ignore }}
|
||||
INPUT_TOKEN: ${{ inputs.TOKEN }}
|
||||
PYTHONPATH: ${{ github.action_path }}
|
||||
|
||||
14
audit.py
14
audit.py
@@ -97,9 +97,11 @@ class Entry:
|
||||
table.append(
|
||||
(
|
||||
"Patched Versions",
|
||||
" OR ".join(self.entry["versions"]["patched"])
|
||||
if len(self.entry["versions"]["patched"]) > 0
|
||||
else "n/a",
|
||||
(
|
||||
" OR ".join(self.entry["versions"]["patched"])
|
||||
if len(self.entry["versions"]["patched"]) > 0
|
||||
else "n/a"
|
||||
),
|
||||
)
|
||||
)
|
||||
if len(self.entry["versions"]["unaffected"]) > 0:
|
||||
@@ -398,6 +400,10 @@ def run() -> None:
|
||||
extra_args.append("--deny")
|
||||
extra_args.append("warnings")
|
||||
|
||||
if os.environ["INPUT_FILE"] != "":
|
||||
extra_args.append("--file")
|
||||
extra_args.append(os.environ["INPUT_FILE"])
|
||||
|
||||
audit_cmd = ["cargo", "audit", "--json"] + extra_args + ignore_args
|
||||
debug(f"Running command: {audit_cmd}")
|
||||
completed = subprocess.run(
|
||||
@@ -406,7 +412,9 @@ def run() -> None:
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
debug(f"Command return code: {completed.returncode}")
|
||||
debug(f"Command output: {completed.stdout}")
|
||||
debug(f"Command error: {completed.stderr}")
|
||||
data = json.loads(completed.stdout)
|
||||
|
||||
summary = create_summary(data)
|
||||
|
||||
Reference in New Issue
Block a user