Skip to content

Migrations: Squawk on each new migration's SQL (sc-9611) #22

Migrations: Squawk on each new migration's SQL (sc-9611)

Migrations: Squawk on each new migration's SQL (sc-9611) #22

Workflow file for this run

# Known vulnerabilities and licences in the dependencies: cargo-deny for the three Rust workspaces (deny.toml beside
# each manifest: RustSec advisories, licences, sources), Trivy for every lockfile (Cargo, pnpm, Bundler, pip; dev
# dependencies included, fixable findings only, ignores in .trivyignore.yaml with an expiry). In deny.toml, an ignore or
# an allowed licence that no longer matches anything fails too; a Trivy ignore fails again when it expires.
#
# Its own workflow, not CI's: a new advisory can turn it red without any change here, and CI's result on main decides
# the CLI release (release.yml). Pull requests run it (a required check), and so does a daily run on main, whose
# failure reaches the coordinator like any other.
name: Audit
on:
pull_request:
push:
branches: [main]
schedule:
- cron: "41 4 * * *"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: audit-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0
with:
install_args: cargo-deny trivy
- name: cargo-deny
run: |
status=0
for manifest in Cargo.toml clients/gallery/rust/Cargo.toml clients/gallery/rust/examples/loco/Cargo.toml; do
echo "::group::$manifest"
cargo deny --manifest-path "$manifest" check -D advisory-not-detected -D license-not-encountered || status=1
echo "::endgroup::"
done
exit $status
- name: Trivy (lockfiles)
run: >-
trivy fs --scanners vuln --include-dev-deps --ignore-unfixed --exit-code 1
--ignorefile .trivyignore.yaml --skip-dirs target --skip-dirs '**/node_modules' .
# Trivy only knows lockfiles by their usual names: the Rails example's second bundle (the Sprockets one ci.yml
# tests) goes in under Gemfile.lock.
- name: Trivy (Rails example, Sprockets bundle)
run: |
dir=$RUNNER_TEMP/sprockets && mkdir -p "$dir"
cp clients/gallery/ruby/examples/rails/Gemfile.sprockets.lock "$dir/Gemfile.lock"
trivy fs --scanners vuln --ignore-unfixed --exit-code 1 --ignorefile .trivyignore.yaml "$dir"
# The app image production runs (the commit https://api.visualci.com/status reports), daily and by hand: CI's scan of
# an image only gates pull requests, so a CVE published after a deploy is caught here.
live-image:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0
with:
install_args: trivy
- run: |
commit=$(curl -fsS --retry 3 --max-time 10 https://api.visualci.com/status | jq -r '.commit // empty')
[[ "$commit" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::no commit from https://api.visualci.com/status"; exit 1; }
trivy image --scanners vuln --ignore-unfixed --severity HIGH,CRITICAL --exit-code 1 --ignorefile .trivyignore.yaml \
"ghcr.io/docspring/visualci-app:$commit"
# Every link on the live site, outside ones included (lychee.toml), daily and by hand: CI checks the site's own links
# offline, so a page someone else moved or took down turns up here.
links:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0
with:
install_args: lychee
# The pages from the live sitemap. GITHUB_TOKEN keeps lychee's github.com checks inside the API's rate limit.
- env:
GITHUB_TOKEN: ${{ github.token }}
run: |
curl -fsS --retry 3 --max-time 20 https://visualci.com/sitemap.xml | grep -o '<loc>[^<]*' | cut -c6- >pages.txt
[ -s pages.txt ] || { echo "::error::no pages in https://visualci.com/sitemap.xml"; exit 1; }
lychee --format compact --files-from pages.txt