Compare commits

..

36 Commits

Author SHA1 Message Date
Jonas Bushart
160ac8b6ed Merge pull request #78 from actions-rust-lang/working-directory 2024-05-05 16:26:46 +03:00
Jonas Bushart
b8800a8c21 Add working directory input to configure where cargo audit executes 2024-05-05 15:46:02 +03:00
Jonas Bushart
1010e1e336 Fix spelling 2024-04-30 22:33:03 +02:00
Jonas Bushart
72f0fdca3b Merge pull request #77 from actions-rust-lang/pre-commit-ci-update-config 2024-04-29 22:43:23 +02:00
pre-commit-ci[bot]
cbff13557b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 24.4.0 → 24.4.2](https://github.com/psf/black/compare/24.4.0...24.4.2)
- [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.10.0)
2024-04-29 17:35:05 +00:00
Jonas Bushart
08bf11f3ea Merge pull request #76 from actions-rust-lang/pre-commit-ci-update-config 2024-04-15 21:55:21 +02:00
pre-commit-ci[bot]
7049db077c [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 24.3.0 → 24.4.0](https://github.com/psf/black/compare/24.3.0...24.4.0)
- [github.com/python-jsonschema/check-jsonschema: 0.28.1 → 0.28.2](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.1...0.28.2)
2024-04-15 17:32:39 +00:00
Jonas Bushart
e8ea165957 Merge pull request #75 from actions-rust-lang/pre-commit-ci-update-config 2024-04-08 23:01:48 +02:00
pre-commit-ci[bot]
1926841165 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0)
2024-04-08 17:36:39 +00:00
Jonas Bushart
08a60eccbb Merge pull request #74 from actions-rust-lang/pre-commit-ci-update-config 2024-04-01 21:45:01 +02:00
pre-commit-ci[bot]
16af786dc7 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/python-jsonschema/check-jsonschema: 0.28.0 → 0.28.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.0...0.28.1)
2024-04-01 17:27:21 +00:00
Jonas Bushart
ddc21578b3 Merge pull request #72 from lwshang/cargo_install_locked 2024-03-26 10:38:08 +01:00
Jonas Bushart
c37ceabcab Merge pull request #73 from actions-rust-lang/pre-commit-ci-update-config 2024-03-26 10:36:47 +01:00
pre-commit-ci[bot]
342fdff255 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.15.2)
2024-03-25 17:28:08 +00:00
Linwei Shang
b719ea468c feat: add --locked to cargo install cargo-audit 2024-03-22 17:34:49 -04:00
Jonas Bushart
25528f1e0b Merge pull request #70 from actions-rust-lang/pre-commit-ci-update-config 2024-03-18 18:43:54 +01:00
pre-commit-ci[bot]
f4430692fd [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 24.2.0 → 24.3.0](https://github.com/psf/black/compare/24.2.0...24.3.0)
2024-03-18 17:31:08 +00:00
Jonas Bushart
0f2a92891d Merge pull request #69 from actions-rust-lang/pre-commit-ci-update-config 2024-03-12 22:28:59 +01:00
pre-commit-ci[bot]
c248204ea6 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0)
2024-03-12 20:13:13 +00:00
Jonas Bushart
e7db852e4a Merge pull request #68 from actions-rust-lang/pre-commit-ci-update-config 2024-02-26 15:32:45 +01:00
pre-commit-ci[bot]
494d723603 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 24.1.1 → 24.2.0](https://github.com/psf/black/compare/24.1.1...24.2.0)
- [github.com/asottile/pyupgrade: v3.15.0 → v3.15.1](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.15.1)
2024-02-19 17:33:03 +00:00
Jonas Bushart
50559e3f2c Update cargo-audit to 0.20.0 2024-02-18 16:20:11 +01:00
Jonas Bushart
27b62ea8ec Merge pull request #67 from actions-rust-lang/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-02-12 19:01:22 +01:00
pre-commit-ci[bot]
e207bcd5c9 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/python-jsonschema/check-jsonschema: 0.27.4 → 0.28.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.27.4...0.28.0)
2024-02-12 17:24:18 +00:00
Jonas Bushart
7d76eb83b1 Merge pull request #66 from actions-rust-lang/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-02-05 19:05:28 +01:00
pre-commit-ci[bot]
3e63858e0b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/python-jsonschema/check-jsonschema: 0.27.3 → 0.27.4](https://github.com/python-jsonschema/check-jsonschema/compare/0.27.3...0.27.4)
2024-02-05 17:22:30 +00:00
Jonas Bushart
5308f89d29 Update cargo-audit to 0.19.0 2024-02-03 22:23:31 +01:00
Jonas Bushart
65c5146921 Merge pull request #63 from lwshang/patch-1 2024-02-03 22:19:25 +01:00
Jonas Bushart
6e072ef47a Merge pull request #64 from actions-rust-lang/pre-commit-ci-update-config 2024-01-29 18:30:09 +01:00
pre-commit-ci[bot]
8001bc456e [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-01-29 17:26:11 +00:00
pre-commit-ci[bot]
cbfe81d58f [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1)
2024-01-29 17:26:02 +00:00
Linwei Shang
89b10d9af6 Upgrade actions/cache to v4
GitHub is deprecating node16 (cache@v3 using).
2024-01-26 14:40:23 -05:00
Jonas Bushart
61ccdfe0c5 Merge pull request #62 from actions-rust-lang/more-debug-logging 2024-01-20 00:28:36 +01:00
Jonas Bushart
959eb6cc5c Update changelog 2024-01-20 00:23:38 +01:00
Jonas Bushart
96eb2dcbe4 Generate lockfile when not existing
Whenever the `file` argument is set give, then cargo audit will not generate the file if it doesn't exist
2024-01-19 23:59:25 +01:00
Jonas Bushart
6943412b48 Add some debug logging for cargo audit 2024-01-19 23:28:36 +01:00
5 changed files with 49 additions and 22 deletions

View File

@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-ast
- id: check-case-conflict
@@ -20,18 +20,18 @@ repos:
- id: isort
args: ["--profile=black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies:
- types-requests
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.3
rev: 0.28.2
hooks:
- id: check-dependabot
- id: check-github-actions

View File

@@ -7,6 +7,18 @@ 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)

View File

@@ -1,6 +1,6 @@
# Audit Rust dependencies using the RustSec Advisory DB
Audit your Rust dependencies using [cargo audit] and the [RustSec Advisory DB]. The action creates a summary with all vulnerabilieties. It can create issues for each of the found vulnerabilities.
Audit your Rust dependencies using [cargo audit] and the [RustSec Advisory DB]. The action creates a summary with all vulnerabilities. It can create issues for each of the found vulnerabilities.
Execution Summary:
@@ -44,18 +44,19 @@ jobs:
## Inputs
All inputs are optional.
Consider adding a [`audit.toml` configuration file] to your repository for further configurations.
Consider adding an [`audit.toml` configuration file] to your repository for further configurations.
cargo audit supports multiple warning types, such as unsound code or yanked crates.
Configuration is only possible via the `informational_warnings` parameter in the configuration file ([#318](https://github.com/rustsec/rustsec/issues/318)).
Setting `denyWarnings` to true will also enable these warnings, but each warning is upgraded to an error.
| Name | Description | Default |
| -------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `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. | `Cargo.lock` |
| `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'` |
| Name | Description | Default |
| ------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `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 to inspect 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'` |
| `workingDirectory` | Run `cargo audit` from the given working directory | |
## License

View File

@@ -15,9 +15,9 @@ inputs:
required: false
default: "false"
file:
description: "Cargo lockfile to inspect"
description: "The path to the Cargo.lock file to inspect"
required: false
default: "Cargo.lock"
default: ""
ignore:
description: "A comma separated list of Rustsec IDs to ignore"
required: false
@@ -26,6 +26,10 @@ inputs:
description: Create/Update issues for each found vulnerability.
required: false
default: "${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}"
workingDirectory:
description: "Run `cargo audit` from the given working directory"
required: false
default: ""
runs:
using: composite
@@ -34,19 +38,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 --locked
shell: bash
- run: |
@@ -59,5 +63,6 @@ runs:
INPUT_FILE: ${{ inputs.file }}
INPUT_IGNORE: ${{ inputs.ignore }}
INPUT_TOKEN: ${{ inputs.TOKEN }}
INPUT_WORKING_DIRECTORY: ${{ inputs.workingDirectory }}
PYTHONPATH: ${{ github.action_path }}
REPO: ${{ github.repository }}

View File

@@ -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:
@@ -402,15 +404,22 @@ def run() -> None:
extra_args.append("--file")
extra_args.append(os.environ["INPUT_FILE"])
working_directory = None
if os.environ["INPUT_WORKING_DIRECTORY"] != "":
working_directory = os.environ["INPUT_WORKING_DIRECTORY"]
audit_cmd = ["cargo", "audit", "--json"] + extra_args + ignore_args
debug(f"Running command: {audit_cmd}")
completed = subprocess.run(
audit_cmd,
cwd=working_directory,
capture_output=True,
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)