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/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Weekly updates, grouped so a week is one pull request per ecosystem, not dozens. Major
# versions come as their own pull requests, since they need code changes; the limits keep
# the queue short. Each pull request still passes ci-ok, deny and osv included.
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 3
commit-message:
prefix: deps
groups:
cargo:
update-types: [minor, patch]

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 2
commit-message:
prefix: ci
groups:
actions:
patterns: ["*"]
95 changes: 94 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
runner: macos-15
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
# Releases ship Linux arm64 too; GitHub gives public repositories arm runners.
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
name: check (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
steps:
Expand Down Expand Up @@ -86,10 +89,100 @@ jobs:
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
- run: cargo test --workspace --locked

# The web client is built for wasm exactly as releases build it, so a change that breaks
# it fails here and not on a release tag.
web:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Toolchain
run: |
rustup toolchain install "$TOOLCHAIN" --profile minimal
rustup default "$TOOLCHAIN"
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: ci-web
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: scripts/build-web.sh

# Supply chain. The scanners are release binaries checked against a SHA-256 written here,
# not actions: an upstream release that changes under the same tag fails the check.

# Advisories, licenses, banned crates and sources, as deny.toml sets them.
deny:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Toolchain
run: |
rustup toolchain install "$TOOLCHAIN" --profile minimal
rustup default "$TOOLCHAIN"
- name: cargo-deny
env:
VERSION: "0.20.2"
SHA256: 9f12ed4c49936e09b48bf862b595cde2fe64fcbd9d74dfacac6131ca824c8d5f
run: |
name="cargo-deny-$VERSION-x86_64-unknown-linux-musl"
curl -fsSL --proto '=https' --tlsv1.2 -o "$RUNNER_TEMP/deny.tar.gz" \
"https://github.com/EmbarkStudios/cargo-deny/releases/download/$VERSION/$name.tar.gz"
echo "$SHA256 $RUNNER_TEMP/deny.tar.gz" | sha256sum -c -
tar -xzf "$RUNNER_TEMP/deny.tar.gz" -C "$RUNNER_TEMP" --strip-components=1 "$name/cargo-deny"
- name: Scan
run: |
"$RUNNER_TEMP/cargo-deny" --locked check

# Known vulnerabilities in every lockfile of the repository, from osv.dev; the exceptions
# are in osv-scanner.toml.
osv:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: osv-scanner
env:
VERSION: v2.7.0
SHA256: 160c6253e2922e9e0a6a9771c5c4c40a4b3c6090b34a3cdd5e80c96cc2e4218b
run: |
curl -fsSL --proto '=https' --tlsv1.2 -o "$RUNNER_TEMP/osv-scanner" \
"https://github.com/google/osv-scanner/releases/download/$VERSION/osv-scanner_linux_amd64"
echo "$SHA256 $RUNNER_TEMP/osv-scanner" | sha256sum -c -
chmod +x "$RUNNER_TEMP/osv-scanner"
- name: Scan
run: |
"$RUNNER_TEMP/osv-scanner" scan source --recursive .

# Secrets in any commit reachable from the checked-out one, not only the latest diff: a key
# removed in a later commit of the same pull request is still published. Known false
# positives are in .gitleaksignore.
secrets:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: gitleaks
env:
VERSION: "8.30.1"
SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
run: |
curl -fsSL --proto '=https' --tlsv1.2 -o "$RUNNER_TEMP/gitleaks.tar.gz" \
"https://github.com/gitleaks/gitleaks/releases/download/v$VERSION/gitleaks_${VERSION}_linux_x64.tar.gz"
echo "$SHA256 $RUNNER_TEMP/gitleaks.tar.gz" | sha256sum -c -
tar -xzf "$RUNNER_TEMP/gitleaks.tar.gz" -C "$RUNNER_TEMP" gitleaks
- name: Scan
run: |
"$RUNNER_TEMP/gitleaks" git --no-banner --redact --exit-code 1 .

# One name for branch protection and the merge queue to require.
ci-ok:
if: always()
needs: [fmt, changes, check]
needs: [fmt, changes, check, web, deny, osv, secrets]
runs-on: ubuntu-24.04
steps:
- name: All jobs passed
Expand Down
58 changes: 52 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# a tag on a commit of a release/* branch is a full release, any other tag (nightlies, tagged
# on main) is a pre-release;
# the desktop client also ships: as Duskcode.app in a disk image on macOS, and as an AppImage
# on Linux amd64 and arm64.
# on Linux amd64 and arm64. Every release carries a CycloneDX SBOM of each shipped program.
# Started by hand, it only builds, to check the build before a tag.
name: release

Expand All @@ -14,6 +14,9 @@ on:
permissions:
contents: read

env:
TOOLCHAIN: "1.99.1" # the same as ci.yml, so a release is built by the compiler CI tested

jobs:
create:
if: startsWith(github.ref, 'refs/tags/v')
Expand Down Expand Up @@ -69,9 +72,8 @@ jobs:
persist-credentials: false
- name: Toolchain
run: |
rustup update stable
rustup default stable
rustup target add ${{ matrix.target }}
rustup toolchain install "$TOOLCHAIN" --profile minimal --target ${{ matrix.target }}
rustup default "$TOOLCHAIN"
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: ${{ matrix.target }}
Expand Down Expand Up @@ -193,8 +195,8 @@ jobs:
persist-credentials: false
- name: Toolchain
run: |
rustup update stable
rustup default stable
rustup toolchain install "$TOOLCHAIN" --profile minimal
rustup default "$TOOLCHAIN"
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: appimage-${{ matrix.arch }}
Expand Down Expand Up @@ -227,3 +229,47 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" dist/*.AppImage --repo "$GITHUB_REPOSITORY"

# A CycloneDX SBOM of every crate in each shipped program: the terminal client (which
# embeds the web client), the web client and the desktop client. Dependencies of every
# target are listed, so one file covers all release platforms.
sbom:
needs: create
if: always() && (needs.create.result == 'success' || needs.create.result == 'skipped')
runs-on: ubuntu-24.04
permissions:
contents: write # uploads the SBOM to the release
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Toolchain
run: |
rustup toolchain install "$TOOLCHAIN" --profile minimal
rustup default "$TOOLCHAIN"
- name: cargo-cyclonedx
env:
VERSION: "0.5.9"
SHA256: fb8dbee9f182173e062a64a387b21a0badc6fab8b2abf9294973f012972bf6d8
run: |
name=cargo-cyclonedx-x86_64-unknown-linux-gnu
curl -fsSL --proto '=https' --tlsv1.2 -o "$RUNNER_TEMP/cyclonedx.tar.xz" \
"https://github.com/CycloneDX/cyclonedx-rust-cargo/releases/download/cargo-cyclonedx-$VERSION/$name.tar.xz"
echo "$SHA256 $RUNNER_TEMP/cyclonedx.tar.xz" | sha256sum -c -
tar -xJf "$RUNNER_TEMP/cyclonedx.tar.xz" -C "$RUNNER_TEMP" --strip-components=1 "$name/cargo-cyclonedx"
- name: SBOM
shell: bash
run: |
version=$(cargo metadata --no-deps --format-version 1 | python3 -c 'import json,sys; print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"] == "dusk_core"))')
# The commit time, so the same commit gives the same file.
SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) \
"$RUNNER_TEMP/cargo-cyclonedx" cyclonedx --format json --spec-version 1.5 --target all
mkdir -p dist
cp projects/clients/terminal/dusk_terminal.cdx.json "dist/duskcode-$version.cdx.json"
cp projects/clients/browser/dusk_browser.cdx.json "dist/duskcode-web-$version.cdx.json"
cp projects/clients/desktop/dusk_desktop.cdx.json "dist/duskcode-desktop-$version.cdx.json"
- name: Upload
if: startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" dist/*.cdx.json --repo "$GITHUB_REPOSITORY"
6 changes: 6 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Known false positives, by fingerprint (commit:file:rule:line).
# The plugin index public key (index.rs PUBLIC_KEY), quoted in a test: public, not a secret.
8b365d8bca33ef6098cba7fcd8e1113f842b1e0f:projects/core/src/plugins/store/workshop_tests.rs:generic-api-key:56
8b365d8bca33ef6098cba7fcd8e1113f842b1e0f:projects/core/src/plugins/store/workshop_tests.rs:generic-api-key:83
# The sample Sec-WebSocket-Key nonce from RFC 6455, section 1.3.
d59429f25943a070cd6bb300f50a07ad144d85f9:projects/web/tests/browser.rs:generic-api-key:81
2 changes: 2 additions & 0 deletions changes/ci-supply-chain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Security
CI checks the supply chain on every pull request: cargo-deny (RustSec advisories, licenses, crate sources), osv-scanner over the lockfiles and gitleaks over the history; Dependabot proposes weekly cargo and action updates. CI also builds the web client for wasm and checks Linux arm64; releases are built with the same Rust 1.99.1 as CI and carry a CycloneDX SBOM of each program.
68 changes: 68 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# cargo-deny: what may enter the dependency tree. CI runs `cargo deny check` on every pull
# request; run it locally with `cargo deny check` before changing Cargo.toml or Cargo.lock.

[graph]
all-features = false

[advisories]
version = 2
# Vulnerabilities and yanked crates always fail. Unmaintained crates fail only when a
# workspace crate depends on them directly: there we can choose another crate, while a
# transitive one waits for its parent to move (gpui, sqlx, rodio, ...).
unmaintained = "workspace"
yanked = "deny"
# Every entry says why it is safe for now and what removes it; review them on each release.
ignore = [
# SQLite < 3.54.0 can return stale page-cache bytes when opening a database whose -wal
# file was crafted by someone else. The bundled copy comes from sqlx-sqlite 0.9.0, the
# newest sqlx, which pins libsqlite3-sys 0.37; the fix (0.39) needs a sqlx release.
# Our databases live under ~/.config/duskcode and are written only by duskcode, so the
# precondition (a less trusted party writes the files) does not hold. Remove with the
# sqlx upgrade.
{ id = "RUSTSEC-2026-0459", reason = "fix needs a sqlx release; databases are written only by duskcode" },
# rmcp < 3.9.0 buffers HTTP response bodies without a limit: a hostile MCP server can
# exhaust memory. Fixed by `cargo update -p rmcp` to >= 3.9.0 (semver-compatible), which
# lands as its own change with a full build and test. Remove then.
{ id = "RUSTSEC-2026-0462", reason = "fix is cargo update -p rmcp >= 3.9.0, landing as its own change" },
# chrono is a direct dependency and is now marked unmaintained. Replacing it touches the
# core and the clients; until then it stays, with no known vulnerability.
{ id = "RUSTSEC-2026-0543", reason = "direct dependency; replacement tracked separately, no known vulnerability" },
]

[licenses]
version = 2
# Permissive licenses only, plus MPL-2.0 (file-level copyleft: symphonia, dwrote, cbindgen,
# option-ext; their source stays MPL and our code stays MIT). GPL and LGPL appear in the tree
# only as one choice of an OR (self_cell, r-efi), so the permissive choice is taken.
allow = [
"0BSD",
"Apache-2.0",
"Apache-2.0 WITH LLVM-exception",
"BSD-2-Clause",
"BSD-3-Clause",
"BSL-1.0",
"CC0-1.0",
"CDLA-Permissive-2.0",
"ISC",
"MIT",
"MIT-0",
"MPL-2.0",
"Unicode-3.0",
"Unlicense",
"Zlib",
]
confidence-threshold = 0.9

[bans]
# Duplicate versions are common in a tree this size; show them, do not fail on them.
multiple-versions = "warn"
wildcards = "deny"
# Workspace crates reference each other by path without a version; they are never published.
allow-wildcard-paths = true

[sources]
# crates.io only. A git source or another registry must be added here by name, on purpose.
unknown-registry = "deny"
unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = []
63 changes: 63 additions & 0 deletions osv-scanner.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# osv-scanner: the same exceptions as deny.toml. osv-scanner also reports RustSec
# "unmaintained" notices of transitive crates, which deny.toml leaves out; they are listed
# here with a date, so each is looked at again instead of being forgotten.

[[IgnoredVulns]]
id = "RUSTSEC-2026-0459"
ignoreUntil = 2027-02-17
reason = "libsqlite3-sys: fix needs a sqlx release; databases are written only by duskcode (see deny.toml)"

[[IgnoredVulns]]
id = "RUSTSEC-2026-0462"
ignoreUntil = 2026-12-17
reason = "rmcp: fix is cargo update -p rmcp >= 3.9.0, landing as its own change (see deny.toml)"

[[IgnoredVulns]]
id = "RUSTSEC-2026-0543"
ignoreUntil = 2027-02-17
reason = "chrono unmaintained: direct dependency, replacement tracked separately (see deny.toml)"

[[IgnoredVulns]]
id = "RUSTSEC-2025-0141"
ignoreUntil = 2027-02-17
reason = "bincode unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2024-0384"
ignoreUntil = 2027-02-17
reason = "instant unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2024-0436"
ignoreUntil = 2027-02-17
reason = "paste unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2025-0134"
ignoreUntil = 2027-02-17
reason = "rustls-pemfile unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2026-0206"
ignoreUntil = 2027-02-17
reason = "rustybuzz unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2026-0192"
ignoreUntil = 2027-02-17
reason = "ttf-parser unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2026-0371"
ignoreUntil = 2027-02-17
reason = "zbus_names unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2026-0370"
ignoreUntil = 2027-02-17
reason = "zvariant unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"

[[IgnoredVulns]]
id = "RUSTSEC-2026-0372"
ignoreUntil = 2027-02-17
reason = "zvariant_derive unmaintained: transitive, waits for its parent crate (deny.toml: unmaintained = workspace)"
Loading