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 .betterleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Betterleaks (secret scanning), run by lefthook on staged changes and by CI's workflows job on a push's or pull
# request's commits, with `--config .betterleaks.toml`. Allow only made-up values that are safe to publish: say what
# each one is.
[extend]
useDefault = true

[[allowlists]]
description = "Local and example database URLs: the test databases' throwaway users (visualci/visualci, loco/loco on 127.0.0.1) and the docs' self-hosting example (visualci:secret@db)"
regexTarget = "match"
regexes = [
'''postgres(ql)?://(visualci|loco):(visualci|loco|secret)@(127\.0\.0\.1|localhost|db)[:/]''',
]

[[allowlists]]
description = "Made-up credentials in URLs that the CLI's tests and doc comments use to check they're redacted"
regexTarget = "match"
regexes = [
'''https://(user:token@host|x-token:secret@github\.com|x-access-token:abc@github\.com)''',
]

[[allowlists]]
description = "CI's Postgres service users, the same throwaway test users"
regexTarget = "match"
regexes = [
'''^PASSWORD: (visualci|loco)$''',
]
8 changes: 5 additions & 3 deletions .github/actions/playwright/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ runs:
. /etc/os-release
echo "key=playwright-debs-$ID-$VERSION_ID-$(dpkg --print-architecture)-" >>"$GITHUB_OUTPUT"
- id: restore
uses: actions/cache/restore@v4
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/playwright-debs
key: ${{ steps.prefix.outputs.key }}none
Expand Down Expand Up @@ -50,6 +50,8 @@ runs:
# Only the versions installed now are kept, so the cache doesn't grow with every package update.
- id: debs
shell: bash
env:
PREFIX: ${{ steps.prefix.outputs.key }}
run: |
dir=$HOME/.cache/playwright-debs
for f in "$dir"/*.deb; do
Expand All @@ -61,10 +63,10 @@ runs:
n=$(find "$dir" -name '*.deb' | wc -l)
echo "$n .deb files to keep"
hash=$(find "$dir" -name '*.deb' -printf '%f\n' | sort | sha256sum | cut -c1-16)
echo "key=${{ steps.prefix.outputs.key }}$hash" >>"$GITHUB_OUTPUT"
echo "key=$PREFIX$hash" >>"$GITHUB_OUTPUT"
echo "count=$n" >>"$GITHUB_OUTPUT"
- if: inputs.save == 'true' && steps.debs.outputs.count != '0' && steps.debs.outputs.key != steps.restore.outputs.cache-matched-key
uses: actions/cache/save@v4
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/playwright-debs
key: ${{ steps.debs.outputs.key }}
83 changes: 83 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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"
Loading
Loading