Repository navigation
78 lines (72 loc) · 3.36 KB
/
Copy pathsecurity.yml
File metadata and controls
78 lines (72 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: security
# Secret scan + Rust supply-chain checks. Actions pinned to commit SHAs.
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
# rustsec/audit-check publishes its findings as a check run. Without this the
# action fails with "Resource not accessible by integration" on push events.
checks: write
concurrency:
group: security-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Secret scan: the shared mechubsec workflow (pinned gitleaks binary; no
# license needed, unlike gitleaks-action on org repos).
secrets:
uses: mechubsec/.github/.github/workflows/gitleaks.yml@fb1a159c596bf2c57b9f6f1ff99f546463a6a84a
cargo:
name: cargo-audit + cargo-deny
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Ensure Cargo.lock exists
run: test -f Cargo.lock || cargo generate-lockfile
- name: cargo-audit (RUSTSEC advisories)
uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Installed directly rather than via cargo-deny-action, which builds its
# own image and so depends on Docker Hub at run time. That dependency has
# now failed this job for real: three retries of
# "dial tcp ...:443: i/o timeout" pulling rust:1.85.0-alpine3.20, with
# nothing wrong in the repo. A supply-chain gate that goes red on an
# unrelated registry outage is a gate people learn to ignore, which is
# worse than not having it. Slower, but it depends only on crates.io,
# which this job already needs. Matches mecmcp and rustpanosmcp.
- name: Install cargo-deny
run: cargo install cargo-deny --locked
- name: cargo-deny (advisories + licenses + bans + sources)
run: cargo deny check advisories licenses bans sources
trivy:
name: trivy (fs + image)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# Installed from the upstream release binary rather than via
# aquasecurity/trivy-action, which runs as a Docker container action and
# so pulls aquasec/trivy from Docker Hub at run time — the same failure
# mode that pushed cargo-deny off cargo-deny-action above. Checksum
# pinned against the release's published checksums.txt.
- name: Install trivy
env:
TRIVY_VERSION: "0.73.0"
TRIVY_SHA256: "2edd39da482bb4e9831962487b68f68e3928ec3137794757f54d00383d79547b"
run: |
curl -sSfL -o trivy.tar.gz \
"https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
echo "${TRIVY_SHA256} trivy.tar.gz" | sha256sum -c -
tar -xzf trivy.tar.gz trivy
sudo mv trivy /usr/local/bin/trivy
- name: trivy fs (dependency + config scan)
run: trivy fs --config trivy.yaml --exit-code 1 --severity HIGH,CRITICAL .
- name: Build image for scanning
run: docker build -t rustjunosmcp:ci .
- name: trivy image (container scan)
run: trivy image --config trivy.yaml --exit-code 1 --severity HIGH,CRITICAL rustjunosmcp:ci