Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/advisories.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Vulnerability advisories the maintainers have looked at and decided to ship
# with for now (packaging/advisory_gate.py, .github/workflows/vulnerabilities.yml).
#
# An accepted advisory is still reported (a notice in every run and a row in
# the job summary) but never fails the check, until its review_by date. After
# that date it counts as unreviewed again, so an acceptance cannot outlive the
# reasons for it unnoticed. Accept an advisory only with a reason a reviewer can
# check: why Graphicle is not exposed (the affected function is never called,
# the feature is off) or why shipping now is still the safer choice, and what
# would end the acceptance (a fixed release of the dependency).
#
# Each entry:
# id the RustSec id
# reason why it is acceptable, and what ends the acceptance
# review_by a date (no quotes) within about three months
# crates optional: only these crates (graphicle, graphicle-graph,
# graphicle-memory); all three when absent
#
# [[accept]]
# id = "RUSTSEC-YYYY-NNNN"
# reason = "..."
# review_by = 2027-02-15
# crates = ["graphicle-graph"]
#
# Advisories the crates' deny.toml files ignore (the zstd and the unmaintained
# entries) never reach this check; move them here to give them review dates.
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# formatted, linted and tested on macOS (Apple silicon) and Linux (x86-64), in
# its own job: the three build folders together would not fit a runner's disk.
# The windows job builds, lints and tests each crate on Windows (x86-64,
# preview); that job says which crates' tests gate.
# preview); that job says which crates' tests gate. Vulnerability advisories
# have their own workflow, vulnerabilities.yml.
name: ci

on:
Expand Down Expand Up @@ -198,13 +199,15 @@ jobs:
run: |
cargo install --locked cargo-deny@0.20.2
cargo install --locked --features cli cargo-about@0.9.2
- name: Engine dependencies (licences, advisories, sources)
working-directory: crates/graphicle-graph
run: cargo deny check
- name: Memory library and program dependency licences
# Licences, banned crates and allowed sources gate every crate here.
# Vulnerability advisories are not a licence question: the
# vulnerabilities workflow ranks them by severity and decides pass, warn
# or fail (.github/workflows/vulnerabilities.yml).
- name: Dependency licences, bans and sources
run: |
(cd crates/graphicle-memory && cargo deny check licenses)
(cd crates/graphicle && cargo deny check licenses)
(cd crates/graphicle-graph && cargo deny check bans licenses sources)
(cd crates/graphicle-memory && cargo deny check bans licenses sources)
(cd crates/graphicle && cargo deny check bans licenses sources)
- name: Adapted-file headers
working-directory: crates/graphicle-graph
run: python3 tools/mark_adapted_files.py --check
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,18 @@ jobs:
id: done
run: echo "signed=true" >> "$GITHUB_OUTPUT"

# Before anything is published: no high or critical vulnerability that is
# neither fixed nor accepted in .github/advisories.toml.
vulnerabilities:
uses: ./.github/workflows/vulnerabilities.yml
with:
mode: release

release:
needs: [build, sign-windows]
# Goes ahead after a successful build whatever became of the signing.
if: ${{ !cancelled() && needs.build.result == 'success' }}
needs: [build, sign-windows, vulnerabilities]
# Goes ahead after a successful build and vulnerability check, whatever
# became of the signing.
if: ${{ !cancelled() && needs.build.result == 'success' && needs.vulnerabilities.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/vulnerabilities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Known vulnerabilities in each crate's dependencies: RustSec advisories, found
# by cargo-deny in the crate's own Cargo.lock and ranked by
# packaging/advisory_gate.py, which decides pass, warn or fail.
#
# A vulnerability is ranked by its CVSS score, or, when RustSec has none (about
# half have none), by its category. Unmaintained, unsound, notice and yanked
# findings are only ever warnings. What fails depends on what is checked:
#
# pull request a high or critical vulnerability the pull request brings in.
# One already on the base branch is a warning: the pull request
# did not cause it, and its author should not have to fix it.
# main, daily a high or critical vulnerability with a fixed version (a
# `cargo update -p` fixes it). Without a fixed version, a
# warning: nobody here can fix it, and it must not stop work.
# release every high or critical vulnerability that is not fixed or
# accepted in .github/advisories.toml (release.yml calls this
# workflow before it publishes).
#
# An advisory accepted in .github/advisories.toml, with a reason and a review
# date, is reported but never fails until that date.
name: vulnerabilities

on:
push:
branches: [main]
pull_request:
# Daily, so that an advisory published against main is seen within a day,
# not at the next push.
schedule:
- cron: "23 5 * * *"
workflow_dispatch:
inputs:
mode:
description: "pr, main or release"
default: main
workflow_call:
inputs:
mode:
type: string
default: release

permissions:
contents: read

env:
RUST_TOOLCHAIN: "1.95.0"
CARGO_DENY_VERSION: "0.20.2"

jobs:
advisories:
name: vulnerabilities (${{ matrix.crate }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
crate: [graphicle, graphicle-graph, graphicle-memory]
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
# A pull request is compared with its base branch's lockfile.
fetch-depth: 0
- name: Toolchain
run: rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal && rustup default "$RUST_TOOLCHAIN"
- name: Cache cargo-deny
id: deny_cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cargo/bin/cargo-deny
key: cargo-deny-${{ env.CARGO_DENY_VERSION }}-${{ runner.os }}
- name: cargo-deny
if: steps.deny_cache.outputs.cache-hit != 'true'
run: cargo install --locked "cargo-deny@$CARGO_DENY_VERSION"
- name: Gate tests
if: matrix.crate == 'graphicle'
run: python3 packaging/test_advisory_gate.py
- name: Advisories
env:
CRATE: ${{ matrix.crate }}
MODE: ${{ inputs.mode || (github.event_name == 'pull_request' && 'pr') || 'main' }}
BASE_REF: ${{ github.base_ref }}
run: |
if [ "$MODE" = pr ]; then
python3 packaging/advisory_gate.py --crate "crates/$CRATE" --mode pr --base "origin/$BASE_REF"
else
python3 packaging/advisory_gate.py --crate "crates/$CRATE" --mode "$MODE"
fi
Loading
Loading