Skip to content

Commit f330924

Browse files
committed
Merge #440: Implement cargo audit security automation for #439
1a5dc56 ci: [#439] add cargo security audit workflow (Jose Celano) 805be28 docs: [#439] add cargo audit security reports (Jose Celano) 28b7018 build: [#439] update vulnerable dependency versions (Jose Celano) Pull request description: ## Summary Implements issue #439 by adding automated Cargo dependency security auditing, documenting the initial scan, and remediating the reported vulnerable dependency versions. ## Changes - Add a scheduled and manually runnable Cargo security audit workflow - Add dependency security report documentation under docs/security/dependencies - Update vulnerable dependency versions to clear current cargo-audit findings - Add the Cargo Security Audit badge to the main README ## Commit Structure - build: [#439] update vulnerable dependency versions - docs: [#439] add cargo audit security reports - ci: [#439] add cargo security audit workflow ## Validation - ./scripts/pre-commit.sh - cargo audit Closes #439 ACKs for top commit: josecelano: ACK 1a5dc56 Tree-SHA512: b279facc688aa68d59415b56cc5fab69bdc3f54cf546924d7a95e0c0e2620d234f7815fbbee0b5593dc99012bf3b7387312d9bcece4986394399d59b6de3c197
2 parents 3cf8e09 + 1a5dc56 commit f330924

6 files changed

Lines changed: 140 additions & 3 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Cargo Security Audit
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
paths:
7+
- "**/Cargo.toml"
8+
- "**/Cargo.lock"
9+
- ".github/workflows/cargo-security-audit.yml"
10+
11+
pull_request:
12+
paths:
13+
- "**/Cargo.toml"
14+
- "**/Cargo.lock"
15+
- ".github/workflows/cargo-security-audit.yml"
16+
17+
# Scheduled scans are important because new RustSec advisories can appear
18+
# even when the codebase and lockfile do not change.
19+
schedule:
20+
- cron: "0 6 * * *" # Daily at 6 AM UTC
21+
22+
workflow_dispatch:
23+
24+
jobs:
25+
cargo-audit:
26+
name: Audit Rust Dependencies
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 10
29+
30+
# cspell:ignore rustsec
31+
# rustsec/audit-check can create issues and checks on scheduled runs.
32+
permissions:
33+
contents: read
34+
checks: write
35+
issues: write
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v5
40+
41+
- name: Run cargo audit via RustSec action
42+
uses: rustsec/audit-check@v2.0.0
43+
with:
44+
token: ${{ secrets.GITHUB_TOKEN }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ serde = { version = "1.0", features = [ "derive" ] }
6060
serde_json = "1.0"
6161
tempfile = "3.0"
6262
tera = "1.0"
63-
testcontainers = { version = "0.26", features = [ "blocking" ] }
63+
testcontainers = { version = "0.27", features = [ "blocking" ] }
6464
thiserror = "2.0"
6565
torrust-dependency-installer = { path = "packages/dependency-installer" }
6666
torrust-deployer-types = { path = "packages/deployer-types" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Linting](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml) [![Testing](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml) [![Test Dependency Installer](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml) [![E2E Infrastructure Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml) [![E2E Deployment Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml) [![SDK Examples](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-sdk-examples.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-sdk-examples.yml) [![Test LXD Container Provisioning](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml) [![Coverage](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml) [![Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml) [![Backup Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml) [![Docker Security Scan](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml) [![Code Statistics](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml)
1+
[![Linting](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml) [![Testing](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml) [![Test Dependency Installer](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml) [![E2E Infrastructure Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml) [![E2E Deployment Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml) [![SDK Examples](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-sdk-examples.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-sdk-examples.yml) [![Test LXD Container Provisioning](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml) [![Coverage](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml) [![Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml) [![Backup Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml) [![Docker Security Scan](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml) [![Cargo Security Audit](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/cargo-security-audit.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/cargo-security-audit.yml) [![Code Statistics](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml)
22

33
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/torrust/torrust-tracker-deployer?quickstart=1)
44

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Dependency Security Reports
2+
3+
This directory tracks Rust dependency security scans for the deployer workspace.
4+
5+
## Current Status
6+
7+
- Last scan: 2026-04-10
8+
- Tool: `cargo-audit`
9+
- Status: no known RustSec vulnerabilities in `Cargo.lock`
10+
- Latest report: [scans/2026-04-10-cargo-audit.md](scans/2026-04-10-cargo-audit.md)
11+
12+
## Scanning Standard
13+
14+
- Run command: `cargo audit`
15+
- Record date, scanner output summary, and remediation actions.
16+
- If findings remain and cannot be fixed quickly, open a follow-up GitHub issue and link it in the report.
17+
18+
## Related Automation
19+
20+
- Workflow: `.github/workflows/cargo-security-audit.yml`
21+
- RustSec action: <https://github.com/rustsec/audit-check>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!-- cspell:ignore RUSTSEC webpki pemfile -->
2+
3+
# Cargo Audit Security Scan - 2026-04-10
4+
5+
## Scan Metadata
6+
7+
- Date: 2026-04-10
8+
- Tool: `cargo-audit`
9+
- Workspace: `torrust-tracker-deployer`
10+
- Command: `cargo audit`
11+
12+
## Baseline (Before Remediation)
13+
14+
Initial scan found 4 vulnerabilities and 1 warning:
15+
16+
1. `RUSTSEC-2026-0066` - `astral-tokio-tar 0.5.6`
17+
1. `RUSTSEC-2026-0007` - `bytes 1.11.0`
18+
1. `RUSTSEC-2026-0049` - `rustls-webpki 0.103.8`
19+
1. `RUSTSEC-2026-0009` - `time 0.3.44`
20+
1. `RUSTSEC-2025-0134` - `rustls-pemfile 2.2.0` (unmaintained warning)
21+
22+
Baseline output excerpt:
23+
24+
```text
25+
error: 4 vulnerabilities found!
26+
warning: 1 allowed warning found
27+
```
28+
29+
## Remediation Actions
30+
31+
Applied updates:
32+
33+
1. Upgraded `testcontainers` in workspace root from `0.26` to `0.27`.
34+
1. Upgraded `testcontainers` in `packages/dependency-installer` dev-dependencies from `0.25` to `0.27`.
35+
1. Refreshed lockfile with `cargo update`.
36+
37+
These updates pulled patched transitive dependencies, including:
38+
39+
- `bytes 1.11.1`
40+
- `time 0.3.47`
41+
- `rustls-webpki 0.103.10`
42+
43+
## Verification (After Remediation)
44+
45+
Command rerun:
46+
47+
```bash
48+
cargo audit
49+
```
50+
51+
Result:
52+
53+
- Exit code: `0`
54+
- No vulnerabilities reported for current lockfile.
55+
56+
Output excerpt:
57+
58+
```text
59+
Fetching advisory database from `https://github.com/RustSec/advisory-db.git`
60+
Loaded 1042 security advisories
61+
Scanning Cargo.lock for vulnerabilities (380 crate dependencies)
62+
```
63+
64+
## Follow-up Issues
65+
66+
No follow-up issue was required for this scan because all reported vulnerabilities were resolved through dependency updates.
67+
68+
## Related
69+
70+
- Main task: <https://github.com/torrust/torrust-tracker-deployer/issues/439>
71+
- Workflow: `.github/workflows/cargo-security-audit.yml`
72+
- Dependency report index: `docs/security/dependencies/README.md`

packages/dependency-installer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tracing = "0.1"
2222
tracing-subscriber = { version = "0.3", features = [ "env-filter" ] }
2323

2424
[dev-dependencies]
25-
testcontainers = "0.25"
25+
testcontainers = "0.27"
2626

2727
[[test]]
2828
name = "check_command_docker_integration"

0 commit comments

Comments
 (0)