ci: failures reach someone, audits run on what is merged, releases are attested
- notify-ci-failure.yml lists its workflows by name. `workflows: ['*']` is not a wildcard to workflow_run: it matched nothing, so `main` was red from 2026-09-23 with no one told. - cargo audit runs a prebuilt cargo-audit (taiki-e/install-action, pinned by commit) with `--deny warnings`, replacing rustsec/audit-check@v2 - Node 20, a check-run write token, and on a pull request a failure only for "critical", which is how September's advisories passed every PR. .cargo/audit.toml's contract (a new informational advisory fails CI) is now what runs. - security-scan.yml: both audits daily against `main`, so an advisory against something already merged is reported the day it is published, not at the next PR. - cargo deny (licences, sources, bans) with deny.toml: the licence allowlist makes "every bundled licence is GPL-3.0-compatible" a test. The workspace declares `publish = false`, which it never had - and without which cargo-deny judged the app crates as published ones. - CodeQL analyses rust and actions as well as javascript-typescript. The comment saying CodeQL had no Rust support stopped being true in 2025. - ci-node.yml: Pages and id-token write move from the workflow to the one job that needs them (Sonar S8233); the audit installs with --ignore-scripts (S6505); a new `tauri lockstep` job fails when a Tauri crate and its npm package drift apart on Cargo.lock and package-lock.json. - release.yml: build (read-only token, no persisted credentials) and publish (attest + draft) are separate jobs; the tag must match all five version fields; SHA256SUMS.txt is LF, which `sha256sum -c` elsewhere needs; actions/attest-build-provenance attests the .exe and .msi; softprops/action-gh-release is pinned by commit; `workflow_dispatch` with `dry_run` builds any ref without attesting or drafting. - ci-integration.yml also runs for the CLI, exec, audit, release metadata, errors, store, index, Cargo.lock and rust-toolchain.toml - every one of which its end-to-end steps run through. - dependabot.yml: cooldowns, a group per ecosystem for Tauri packages and for actions and pip, TypeScript held below 6.1 (typescript-eslint's peer range), and the rust-toolchain ecosystem. A multi-ecosystem group would put both Tauri halves in one PR, but what it does to dependencies outside its patterns is undocumented; the lockstep job covers the gap instead. - Sonar: NOSONAR with reasons on the dev scripts' argv and PATH lookups; bundle-cli.mjs no longer claims to run from beforeBuildCommand. The dev CSP moves out of index.html into a Vite plugin that reads devCsp from tauri.conf.json, so a release build carries one policy, the strict one (S7039); checked in the dev server, where React Refresh's preamble still runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c6a506652
commit
12bf723daa
20 files changed
+497
-68
No files matched your search
+2
-4
@@ -29,10 +29,8 @@ ignore = [
|
||||
"RUSTSEC-2024-0419", # gtk3-macros — unmaintained
|
||||
"RUSTSEC-2024-0420", # gtk-sys — unmaintained
|
||||
"RUSTSEC-2024-0429", # glib — unsound (VariantStrIter::impl_get); same GTK3 stack
|
||||
|
||||
# --- Build-time only -----------------------------------------------------
|
||||
# A proc-macro helper pulled in by a build dependency. It never reaches a shipped binary, and
|
||||
# the advisory is "unmaintained", not a defect.
|
||||
# A proc-macro, reached through glib-macros: the same stack, not a build dependency of
|
||||
# PipDock's as this file used to say (`cargo tree -i proc-macro-error --target all`).
|
||||
"RUSTSEC-2024-0370", # proc-macro-error — unmaintained
|
||||
|
||||
# --- unic-* Unicode tables ----------------------------------------------
|
||||
|
||||
+55
-7
@@ -4,10 +4,22 @@
|
||||
# ops repo, and that repo ships a dependabot-summary.yml, which makes Dependabot the portfolio
|
||||
# standard.
|
||||
#
|
||||
# Grouping intent carried over from the original spec: weekly grouped minor/patch PRs per
|
||||
# ecosystem, and Code Health pins kept in their own group so they stay reviewable in isolation.
|
||||
# Security advisories bypass grouping and schedule automatically — that is Dependabot's default
|
||||
# for security updates and cannot be configured away here.
|
||||
# Weekly grouped PRs per ecosystem, with Code Health's pins kept apart so a tool bump is reviewed
|
||||
# on its own. Security advisories bypass grouping and schedule — that is Dependabot's default for
|
||||
# security updates and cannot be configured away here.
|
||||
#
|
||||
# **Cooldown**: a release has to be a few days old before it is proposed. Most yanked or
|
||||
# compromised releases are pulled within that window, and nothing here needs a dependency the day
|
||||
# it ships.
|
||||
#
|
||||
# **Tauri moves in lockstep**: the `tauri` crate and `@tauri-apps/api` must share a minor or the
|
||||
# app will not start, and Dependabot cannot bump Cargo and npm in one pull request — a
|
||||
# multi-ecosystem group can, but what it does to the dependencies outside its patterns is not
|
||||
# documented, and guessing wrong would silently stop every other update. So each ecosystem groups
|
||||
# its Tauri packages into one PR, and ci-node.yml's `tauri lockstep` job fails either PR until its
|
||||
# counterpart is merged beside it.
|
||||
#
|
||||
# The labels below must exist in the repository, or Dependabot opens its PRs without them.
|
||||
|
||||
version: 2
|
||||
|
||||
@@ -18,7 +30,13 @@ updates:
|
||||
interval: weekly
|
||||
day: monday
|
||||
open-pull-requests-limit: 5
|
||||
cooldown:
|
||||
default-days: 3
|
||||
semver-major-days: 14
|
||||
groups:
|
||||
# First, so a Tauri crate never lands in the catch-all group below.
|
||||
tauri:
|
||||
patterns: ['tauri', 'tauri-*']
|
||||
cargo-minor-patch:
|
||||
update-types: [minor, patch]
|
||||
labels: [dependencies, rust]
|
||||
@@ -29,7 +47,17 @@ updates:
|
||||
interval: weekly
|
||||
day: monday
|
||||
open-pull-requests-limit: 5
|
||||
cooldown:
|
||||
default-days: 3
|
||||
semver-major-days: 14
|
||||
ignore:
|
||||
# typescript-eslint 8.71 peers `typescript >=4.8.4 <6.1.0`, so a 6.1 bump fails `npm ci` with
|
||||
# ERESOLVE before a single check runs. Remove once typescript-eslint widens its range.
|
||||
- dependency-name: typescript
|
||||
versions: ['>=6.1.0']
|
||||
groups:
|
||||
tauri:
|
||||
patterns: ['@tauri-apps/*']
|
||||
npm-minor-patch:
|
||||
update-types: [minor, patch]
|
||||
labels: [dependencies, frontend]
|
||||
@@ -39,14 +67,34 @@ updates:
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
cooldown:
|
||||
default-days: 7
|
||||
groups:
|
||||
actions:
|
||||
patterns: ['*']
|
||||
labels: [dependencies, ci]
|
||||
|
||||
# Code Health tool pins (deptry / vulture / ruff), shipped with the app and resolved at release
|
||||
# time — CODE-HEALTH-SPEC §2. Kept as its own ecosystem so a bump here is never bundled with
|
||||
# application dependencies.
|
||||
# Code Health tool pins (deptry / vulture / ruff / pip-audit), shipped with the app and resolved
|
||||
# at release time — CODE-HEALTH-SPEC §2. Its own ecosystem, so a bump here is never bundled with
|
||||
# application dependencies. A bump also needs tools-constraints.txt regenerated (the command is
|
||||
# in its header); `cargo test` fails until it is.
|
||||
- package-ecosystem: pip
|
||||
directory: /tools
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
cooldown:
|
||||
default-days: 7
|
||||
groups:
|
||||
code-health:
|
||||
patterns: ['*']
|
||||
labels: [dependencies, code-health]
|
||||
|
||||
# rust-toolchain.toml's pinned channel. A toolchain bump brings new clippy lints, which is why
|
||||
# it gets a PR of its own rather than arriving with a cargo update.
|
||||
- package-ecosystem: rust-toolchain
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
labels: [dependencies, rust]
|
||||
@@ -23,7 +23,19 @@ on:
|
||||
# against a real interpreter is only ever exercised here.
|
||||
- 'crates/pipdock-core/src/probe.py'
|
||||
- 'crates/pipdock-core/src/health/**'
|
||||
# Every end-to-end step drives the CLI, and these are what it runs through. A change to
|
||||
# any of them reached `main` without this job ever seeing it.
|
||||
- 'crates/pipdock-cli/**'
|
||||
- 'crates/pipdock-core/src/exec.rs'
|
||||
- 'crates/pipdock-core/src/audit.rs'
|
||||
- 'crates/pipdock-core/src/release.rs'
|
||||
- 'crates/pipdock-core/src/errors/**'
|
||||
- 'crates/pipdock-core/src/store/**'
|
||||
- 'crates/pipdock-core/src/index/**'
|
||||
- 'crates/pipdock-core/tests/**'
|
||||
# A dependency or toolchain bump is a change to all of the above at once.
|
||||
- 'Cargo.lock'
|
||||
- 'rust-toolchain.toml'
|
||||
- 'spikes/capture.py'
|
||||
# A Dependabot bump to the Code Health pins has to re-run the bootstrap: whether the new
|
||||
# pin set still resolves to wheels on 3.10 and 3.14 is exactly what this job can answer
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Caller into the ops repo's React reusable, plus one local job.
|
||||
# Caller into the ops repo's React reusable, plus local jobs.
|
||||
#
|
||||
# The reusable runs Node 24, `npm ci`, then lint / typecheck / test when the matching npm script
|
||||
# exists, then the build. It has no `npm audit` step, so that gate lives here — see
|
||||
@@ -14,13 +14,8 @@ on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
# The reusable declares a Pages-deploy job needing `pages: write` and `id-token: write`. It is
|
||||
# skipped here (`deploy-pages: false`), but permissions are validated at startup regardless of
|
||||
# `if:`, so a caller that grants less than the callee declares is rejected before it runs.
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: ci-node-${{ github.ref }}
|
||||
@@ -29,6 +24,14 @@ concurrency:
|
||||
jobs:
|
||||
web:
|
||||
name: lint · typecheck · test · build
|
||||
# The reusable declares a Pages-deploy job needing `pages: write` and `id-token: write`. It is
|
||||
# skipped here (`deploy-pages: false`), but permissions are validated at startup regardless of
|
||||
# `if:`, so a caller that grants less than the callee declares is rejected before it runs.
|
||||
# Granted on this job only, not the workflow: the other jobs here never need to write.
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
uses: poli0981/.github/.github/workflows/reusable-web-react.yml@main
|
||||
with:
|
||||
node-version: '24'
|
||||
@@ -44,6 +47,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v7
|
||||
@@ -51,8 +56,25 @@ jobs:
|
||||
node-version: '24'
|
||||
cache: npm
|
||||
|
||||
# The audit reads the lockfile; nothing is built, so no install script has a reason to run.
|
||||
- name: Install
|
||||
run: npm ci
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Audit
|
||||
run: npm audit --audit-level=high
|
||||
|
||||
lockstep:
|
||||
name: tauri lockstep
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
# Tauri refuses to run when the `tauri` crate and `@tauri-apps/api` are on different minors,
|
||||
# and Dependabot bumps the two ecosystems in separate PRs — so either one, merged alone,
|
||||
# leaves a `main` that builds and does not start. The script reads both lockfiles.
|
||||
- name: Crate and npm package on one minor
|
||||
run: node scripts/check-tauri-lockstep.mjs
|
||||
@@ -30,6 +30,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
# rust-toolchain.toml pins the exact version, so no toolchain action is needed — rustup
|
||||
# honours it on first invocation and installs rustfmt and clippy with it.
|
||||
@@ -62,19 +64,47 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
# The action builds cargo-audit from source, and rust-toolchain.toml would otherwise pin
|
||||
# that build to PipDock's toolchain. cargo-audit's own dependency tree already requires a
|
||||
# newer rustc than we pin (kstring needs 1.96), so the audit failed to compile rather than
|
||||
# finding anything. It only reads Cargo.lock, so building it with stable is correct — the
|
||||
# pin exists to make *PipDock* reproducible, not its tooling.
|
||||
# cargo-audit only reads Cargo.lock, so it runs under the runner's stable cargo rather than
|
||||
# making rustup install the toolchain rust-toolchain.toml pins — that pin exists to make
|
||||
# PipDock reproducible, not its tooling.
|
||||
RUSTUP_TOOLCHAIN: stable
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
|
||||
# RustSec advisories against the committed Cargo.lock. Split from the Windows job because
|
||||
# it needs no target build — it is a lockfile scan.
|
||||
- name: Audit
|
||||
uses: rustsec/audit-check@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
# A prebuilt cargo-audit, pinned by commit. This replaced rustsec/audit-check@v2, which ran
|
||||
# on Node 20, needed a check-run write token, and on a pull request failed only on
|
||||
# "critical" — so the advisories that turned `main` red in September passed every PR.
|
||||
- name: Install cargo-audit
|
||||
uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 # v2.87.22
|
||||
with:
|
||||
tool: cargo-audit
|
||||
|
||||
# RustSec advisories against the committed Cargo.lock. `--deny warnings`, because
|
||||
# .cargo/audit.toml's contract is that a *new* informational advisory fails CI and is looked
|
||||
# at; the known ones are ignored there one by one, with reasons.
|
||||
- name: Audit
|
||||
run: cargo audit --deny warnings
|
||||
|
||||
deny:
|
||||
name: cargo deny
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
RUSTUP_TOOLCHAIN: stable
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install cargo-deny
|
||||
uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 # v2.87.22
|
||||
with:
|
||||
tool: cargo-deny
|
||||
|
||||
# Licences, sources and bans — deny.toml says why each. Advisories stay cargo audit's.
|
||||
- name: Licences, sources, bans
|
||||
run: cargo deny --locked check licenses sources bans
|
||||
@@ -1,9 +1,11 @@
|
||||
# Caller into the ops repo's CodeQL reusable.
|
||||
#
|
||||
# JavaScript/TypeScript only: CodeQL has no Rust analyzer, and the reusable's supported set is
|
||||
# csharp, python, javascript-typescript, ruby, c-cpp, java-kotlin, go and swift. Rust's static
|
||||
# analysis is clippy `-D warnings` plus `cargo audit`, both blocking in ci-rust.yml.
|
||||
# See docs/RELEASE-CI.md §1 and docs/SECURITY.md §7.
|
||||
# Three languages. **Rust** — CodeQL analyses it without a build (`build-mode: none`, which the
|
||||
# reusable passes for every language outside its autobuild list); this file said for six releases
|
||||
# that CodeQL had no Rust support, which stopped being true in 2025. **Actions** — the workflows
|
||||
# themselves: the class of mistake SonarCloud kept finding by hand (write permissions at workflow
|
||||
# level, unpinned third-party actions). **JavaScript/TypeScript** — the frontend, and the one
|
||||
# whose check name `main`'s protection requires, so it keeps its exact name.
|
||||
#
|
||||
# The reusable notes that repo Settings → Advanced Security → CodeQL "Default setup" must be
|
||||
# DISABLED, or this advanced-setup workflow is rejected at upload time.
|
||||
@@ -32,4 +34,4 @@ jobs:
|
||||
analyze:
|
||||
uses: poli0981/.github/.github/workflows/reusable-codeql.yml@main
|
||||
with:
|
||||
languages: '["javascript-typescript"]'
|
||||
languages: '["javascript-typescript", "rust", "actions"]'
|
||||
@@ -1,13 +1,22 @@
|
||||
# Caller into the ops repo's Discord CI-failure notifier.
|
||||
#
|
||||
# The reusable skips workflows that have their own dedicated notifier (release, CodeQL,
|
||||
# Dependabot), so this does not double-report.
|
||||
# **Listed by name.** `workflows: ['*']`, which the ops repo's own example suggests, is not a
|
||||
# wildcard to `workflow_run`: it matched nothing, so `main` stayed red from 2026-09-23 with every
|
||||
# failure unreported — the only runs this ever saw were Dependabot's. Adding a workflow means
|
||||
# adding its `name:` here, exactly.
|
||||
#
|
||||
# CodeQL and Release are deliberately absent: the reusable skips workflows with dedicated
|
||||
# notifiers by name ('odeQL', 'elease', …), so listing them would only create skipped runs.
|
||||
|
||||
name: Notify CI Failure
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ['*']
|
||||
workflows:
|
||||
- CI / Rust
|
||||
- CI / Node
|
||||
- CI / Integration
|
||||
- Security scan
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
|
||||
+109
-16
@@ -1,11 +1,20 @@
|
||||
# Project-local: the ops repo has no reusable Tauri/build workflow (docs/RELEASE-CI.md §1).
|
||||
#
|
||||
# Produces the NSIS .exe and .msi, publishes SHA256SUMS.txt and leaves a DRAFT release for owner
|
||||
# review. Publishing is manual on purpose — RELEASE-CI.md §3.4 — and announce-release.yml fires on
|
||||
# `release: published`.
|
||||
# Builds the NSIS .exe and .msi, attests where they were built, publishes SHA256SUMS.txt and leaves
|
||||
# a DRAFT release. Publishing is a separate, human-directed step (RELEASE-CI.md §3.4), and
|
||||
# announce-release.yml fires on `release: published`.
|
||||
#
|
||||
# **Two jobs, so the token that can write releases never runs the build.** Building executes
|
||||
# third-party code — every crate's build script, every npm package's — and gets a read-only token
|
||||
# with no credentials left in the checkout. The publish job only attests and uploads what the build
|
||||
# produced.
|
||||
#
|
||||
# `workflow_dispatch` with `dry_run` builds and checksums any ref — a branch before it merges —
|
||||
# without attesting or drafting anything: the release recipe is tested before a tag depends on it.
|
||||
#
|
||||
# PipDock does not update itself, so there is no signing key and no `latest.json` here. Users get
|
||||
# new versions from the GitHub Releases page. The checksums below are what they verify against.
|
||||
# new versions from the GitHub Releases page; the checksums and the attestation are what they
|
||||
# verify against (docs/SECURITY.md §5).
|
||||
|
||||
name: Release
|
||||
|
||||
@@ -15,12 +24,17 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: Tag to build (for re-runs)
|
||||
required: true
|
||||
description: Tag to build (for re-runs). Empty builds the selected ref.
|
||||
required: false
|
||||
type: string
|
||||
dry_run:
|
||||
description: Build and checksum only — no attestation, no draft release.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write # release assets
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.ref }}
|
||||
@@ -31,14 +45,51 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build · checksum · draft
|
||||
name: Build · checksum
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 90
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
tag: ${{ steps.version.outputs.tag }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ inputs.tag || github.ref }}
|
||||
persist-credentials: false
|
||||
|
||||
# The version lives in five places and they move together (CLAUDE.md), and a tag names the
|
||||
# one they must all carry. A tag pushed before the bump commit, or a bump that missed one
|
||||
# file, would otherwise build an installer whose About states another version.
|
||||
- name: The tag and all five versions agree
|
||||
id: version
|
||||
shell: pwsh
|
||||
env:
|
||||
REF: ${{ inputs.tag || github.ref_name }}
|
||||
DRY_RUN: ${{ inputs.dry_run || false }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$found = [ordered]@{}
|
||||
$found['Cargo.toml'] = (Select-String -Path Cargo.toml -Pattern '^version = "([^"]+)"' |
|
||||
Select-Object -First 1).Matches[0].Groups[1].Value
|
||||
$lock = Get-Content Cargo.lock -Raw
|
||||
if ($lock -notmatch '(?m)^name = "pipdock-core"\r?\nversion = "([^"]+)"') { throw 'pipdock-core is not in Cargo.lock' }
|
||||
$found['Cargo.lock'] = $Matches[1]
|
||||
$found['package.json'] = (Get-Content package.json -Raw | ConvertFrom-Json).version
|
||||
# -AsHashtable: package-lock.json has a property named "", which plain ConvertFrom-Json refuses.
|
||||
$found['package-lock.json'] = (Get-Content package-lock.json -Raw | ConvertFrom-Json -AsHashtable)['version']
|
||||
$found['tauri.conf.json'] = (Get-Content src-tauri/tauri.conf.json -Raw | ConvertFrom-Json).version
|
||||
$found.GetEnumerator() | ForEach-Object { Write-Host ("{0,-18} {1}" -f $_.Key, $_.Value) }
|
||||
$versions = @($found.Values | Sort-Object -Unique)
|
||||
if ($versions.Count -ne 1) { throw "the five versions disagree: $($versions -join ', ')" }
|
||||
$v = $versions[0]
|
||||
if ($env:REF -match '^v\d') {
|
||||
if ($env:REF -ne "v$v") { throw "tag $env:REF does not match version $v" }
|
||||
} elseif ($env:DRY_RUN -ne 'true') {
|
||||
throw "$env:REF is not a version tag; only a dry run builds a branch"
|
||||
}
|
||||
"tag=v$v" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v7
|
||||
@@ -79,21 +130,63 @@ jobs:
|
||||
ForEach-Object { Copy-Item $_.FullName $out }
|
||||
Get-ChildItem $out
|
||||
|
||||
- name: Publish checksums
|
||||
- name: Checksums
|
||||
shell: pwsh
|
||||
run: |
|
||||
# SmartScreen warns on first run because the binaries are not EV-code-signed, so the
|
||||
# README tells users to verify these instead (docs/SECURITY.md §5).
|
||||
Get-ChildItem release-artifacts -File |
|
||||
#
|
||||
# LF line endings, written byte for byte: `Set-Content` wrote CRLF, and `sha256sum -c`
|
||||
# on any other platform reads the CR as part of the file name and reports it missing.
|
||||
$lines = Get-ChildItem release-artifacts -File |
|
||||
Where-Object { $_.Name -ne 'SHA256SUMS.txt' } |
|
||||
ForEach-Object { "$((Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()) $($_.Name)" } |
|
||||
Set-Content release-artifacts\SHA256SUMS.txt -Encoding ascii
|
||||
Sort-Object Name |
|
||||
ForEach-Object { "$((Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()) $($_.Name)" }
|
||||
[IO.File]::WriteAllText(
|
||||
(Join-Path $PWD 'release-artifacts\SHA256SUMS.txt'),
|
||||
(($lines -join "`n") + "`n"),
|
||||
[Text.Encoding]::ASCII)
|
||||
Get-Content release-artifacts\SHA256SUMS.txt
|
||||
|
||||
- name: Draft GitHub release
|
||||
uses: softprops/action-gh-release@v3
|
||||
- name: Upload the build
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
tag_name: ${{ inputs.tag || github.ref_name }}
|
||||
draft: true # owner reviews, then publishes; publishing triggers the announcement
|
||||
name: release-artifacts
|
||||
path: release-artifacts/*
|
||||
if-no-files-found: error
|
||||
|
||||
publish:
|
||||
name: Attest · draft
|
||||
needs: build
|
||||
if: ${{ !inputs.dry_run }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
contents: write # the draft release and its assets
|
||||
id-token: write # Sigstore, for the attestation
|
||||
attestations: write
|
||||
steps:
|
||||
- name: Download the build
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: release-artifacts
|
||||
path: release-artifacts
|
||||
|
||||
# Build provenance for the two installers: `gh attestation verify <file> --repo
|
||||
# poli0981/pipdock` proves an installer came from this workflow, at this commit — which a
|
||||
# checksum published beside the file cannot, since whoever could replace one could replace
|
||||
# both.
|
||||
- name: Attest provenance
|
||||
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
|
||||
with:
|
||||
subject-path: |
|
||||
release-artifacts/*.exe
|
||||
release-artifacts/*.msi
|
||||
|
||||
- name: Draft GitHub release
|
||||
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
|
||||
with:
|
||||
tag_name: ${{ needs.build.outputs.tag }}
|
||||
draft: true # reviewed, then published; publishing triggers the announcement
|
||||
generate_release_notes: true
|
||||
files: release-artifacts/*
|
||||
@@ -0,0 +1,64 @@
|
||||
# Daily advisory scans of `main` — docs/SECURITY.md §7.
|
||||
#
|
||||
# The PR gates (ci-rust.yml's `cargo audit`, ci-node.yml's `npm audit`) only run when something
|
||||
# changes. An advisory published against a dependency already on `main` therefore sat unnoticed
|
||||
# until the next pull request happened to fail on it: that is how `main` went red in September
|
||||
# with no PR open to say so. This runs the same two scans every day against what is merged, and a
|
||||
# failure reaches Discord through notify-ci-failure.yml.
|
||||
#
|
||||
# Not a required check — it runs on no pull request.
|
||||
|
||||
name: Security scan
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Daily, off the hour.
|
||||
- cron: '41 5 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
cargo:
|
||||
name: cargo audit
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
RUSTUP_TOOLCHAIN: stable
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install cargo-audit
|
||||
uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 # v2.87.22
|
||||
with:
|
||||
tool: cargo-audit
|
||||
|
||||
- name: Audit
|
||||
run: cargo audit --deny warnings
|
||||
|
||||
npm:
|
||||
name: npm audit
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '24'
|
||||
cache: npm
|
||||
|
||||
# Nothing is built here, so no package's install script has a reason to run.
|
||||
- name: Install
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Audit
|
||||
run: npm audit --audit-level=high
|
||||
@@ -9,6 +9,9 @@ rust-version = "1.99"
|
||||
license = "GPL-3.0-only"
|
||||
repository = "https://github.com/poli0981/pipdock"
|
||||
authors = ["Kokone (poli0981)"]
|
||||
# Applications, not libraries: nothing here belongs on crates.io, and cargo-deny treats a
|
||||
# publishable crate's licence and path dependencies as a published one's (deny.toml).
|
||||
publish = false
|
||||
|
||||
[workspace.lints.rust]
|
||||
unsafe_code = "forbid"
|
||||
|
||||
@@ -5,6 +5,7 @@ version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# cargo-deny — docs/SECURITY.md §7.
|
||||
#
|
||||
# Licences, sources and bans. Advisories are cargo audit's (ci-rust.yml, a required check):
|
||||
# running both would be two gates on one question with two ignore lists to keep in step.
|
||||
#
|
||||
# The licence allowlist turns THIRD-PARTY-NOTICES.md's claim — every bundled licence is compatible
|
||||
# with GPL-3.0-only — from a sentence into a test. A crate under anything not listed here fails
|
||||
# CI and has to be looked at; widening this list is a licensing decision, not a CI fix.
|
||||
|
||||
[graph]
|
||||
# The one target PipDock ships (ARCHITECTURE §10). Tauri's Linux and macOS stacks are in the lock
|
||||
# file and are never in a release, so judging their licences would judge nothing shipped.
|
||||
targets = ["x86_64-pc-windows-msvc"]
|
||||
|
||||
[licenses]
|
||||
version = 2
|
||||
confidence-threshold = 0.93
|
||||
# Each one GPL-3.0-compatible, per the FSF's list. MPL-2.0 is, by its §3.3 secondary-licence
|
||||
# clause, for every crate here: none carries the "Incompatible With Secondary Licenses" notice.
|
||||
allow = [
|
||||
"0BSD",
|
||||
"Apache-2.0",
|
||||
"BSD-3-Clause",
|
||||
"BSL-1.0",
|
||||
"CC0-1.0",
|
||||
"ISC",
|
||||
"MIT",
|
||||
"MIT-0",
|
||||
"MPL-2.0",
|
||||
"Unicode-3.0",
|
||||
"Unlicense",
|
||||
"Zlib",
|
||||
]
|
||||
|
||||
# PipDock's own crates: GPL-3.0-only, and never published.
|
||||
[licenses.private]
|
||||
ignore = true
|
||||
|
||||
[bans]
|
||||
# Tauri's tree carries several generations of windows-* and two of png; there is nothing for
|
||||
# PipDock to act on in a duplicate it does not choose.
|
||||
multiple-versions = "allow"
|
||||
wildcards = "deny"
|
||||
# The workspace's own path dependencies are versionless by design.
|
||||
allow-wildcard-paths = true
|
||||
|
||||
[sources]
|
||||
# crates.io and nothing else: no git dependency, no other registry, so what Cargo.lock records is
|
||||
# what anyone else can fetch and audit.
|
||||
unknown-registry = "deny"
|
||||
unknown-git = "deny"
|
||||
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
|
||||
@@ -12,9 +12,13 @@
|
||||
* the same restraint SECURITY §5 applies to not shipping a self-updater. The README says where the
|
||||
* binary lands and how to put it on `PATH` if you want it there.
|
||||
*
|
||||
* Run from `beforeBuildCommand` rather than only from the release workflow, so a local
|
||||
* `tauri build` and CI produce the same installer — a bundle that differs by who built it is how
|
||||
* "works on my machine" gets into a release.
|
||||
* Run by `npm run bundle` (package.json), which the release workflow calls too, so a local bundle
|
||||
* and CI produce the same installer — a bundle that differs by who built it is how "works on my
|
||||
* machine" gets into a release. (This said `beforeBuildCommand`; it has never been wired there.)
|
||||
*
|
||||
* `rustc` and `cargo` are found on PATH, which SonarCloud flags (S4036). That is the toolchain the
|
||||
* developer or the runner installed and this script is a build step run by them, with their PATH —
|
||||
* there is no less-trusted caller whose PATH it could be handed.
|
||||
*/
|
||||
|
||||
import { execFileSync } from 'node:child_process'
|
||||
@@ -23,7 +27,7 @@ import { join } from 'node:path'
|
||||
|
||||
/** The host triple, asked of rustc rather than assumed — cross-compiling would break a guess. */
|
||||
function hostTriple() {
|
||||
const out = execFileSync('rustc', ['-vV'], { encoding: 'utf8' })
|
||||
const out = execFileSync('rustc', ['-vV'], { encoding: 'utf8' }) // NOSONAR: see the header
|
||||
const line = out.split('\n').find((l) => l.startsWith('host:'))
|
||||
if (line === undefined) throw new Error('rustc -vV printed no host line')
|
||||
return line.slice('host:'.length).trim()
|
||||
@@ -35,6 +39,7 @@ mkdirSync(target, { recursive: true })
|
||||
|
||||
// `--locked` for the reason the release workflow passes it: a bundle is not the place to discover
|
||||
// that a dependency resolved differently than the lockfile says.
|
||||
// NOSONAR: see the header — the developer's own cargo.
|
||||
execFileSync('cargo', ['build', '--release', '--locked', '-p', 'pipdock-cli'], {
|
||||
stdio: 'inherit',
|
||||
})
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Fail when the Tauri crates and the `@tauri-apps/*` packages are on different minors.
|
||||
*
|
||||
* Tauri checks this itself and refuses to start — at runtime, on the user's machine — when the
|
||||
* `tauri` crate and `@tauri-apps/api` disagree on major.minor. Dependabot bumps Cargo and npm in
|
||||
* separate pull requests, each green on its own, so merging one of them alone ships a build that
|
||||
* compiles and does not open. This reads both lockfiles, so it checks what is built rather than
|
||||
* what the manifests ask for.
|
||||
*
|
||||
* Plugins move independently of the core (`tauri-plugin-dialog` 2.8 sits beside `tauri` 2.12), so
|
||||
* each plugin crate is compared with its own npm package, not with `tauri`.
|
||||
*/
|
||||
|
||||
import { readFileSync } from 'node:fs'
|
||||
|
||||
const PAIRS = [
|
||||
['tauri', '@tauri-apps/api'],
|
||||
['tauri-plugin-dialog', '@tauri-apps/plugin-dialog'],
|
||||
['tauri-plugin-opener', '@tauri-apps/plugin-opener'],
|
||||
['tauri-plugin-clipboard-manager', '@tauri-apps/plugin-clipboard-manager'],
|
||||
]
|
||||
|
||||
/** Every `name = "…" / version = "…"` pair in Cargo.lock. */
|
||||
function crateVersions() {
|
||||
const lock = readFileSync('Cargo.lock', 'utf8')
|
||||
const out = new Map()
|
||||
for (const block of lock.split('[[package]]')) {
|
||||
const name = /^name = "([^"]+)"$/m.exec(block)?.[1]
|
||||
const version = /^version = "([^"]+)"$/m.exec(block)?.[1]
|
||||
if (name !== undefined && version !== undefined) out.set(name, version)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
function npmVersion(name) {
|
||||
const lock = JSON.parse(readFileSync('package-lock.json', 'utf8'))
|
||||
return lock.packages?.[`node_modules/${name}`]?.version
|
||||
}
|
||||
|
||||
const minor = (v) => v.split('.').slice(0, 2).join('.')
|
||||
|
||||
const crates = crateVersions()
|
||||
let failed = false
|
||||
for (const [crate, pkg] of PAIRS) {
|
||||
const rust = crates.get(crate)
|
||||
const js = npmVersion(pkg)
|
||||
if (rust === undefined || js === undefined) {
|
||||
console.error(`missing: ${crate} ${rust ?? '(not in Cargo.lock)'} / ${pkg} ${js ?? '(not in package-lock.json)'}`)
|
||||
failed = true
|
||||
continue
|
||||
}
|
||||
const ok = minor(rust) === minor(js)
|
||||
console.log(`${ok ? 'ok ' : 'FAIL'} ${crate} ${rust} ${pkg} ${js}`)
|
||||
if (!ok) failed = true
|
||||
}
|
||||
if (failed) {
|
||||
console.error('Bump the crate and its npm package together; Tauri will not start otherwise.')
|
||||
process.exit(1)
|
||||
}
|
||||
+3
-1
@@ -199,7 +199,9 @@ def run(
|
||||
env = None
|
||||
if extra_env:
|
||||
env = {**os.environ, **extra_env}
|
||||
return subprocess.run(
|
||||
# NOSONAR below (S8701): a developer tool. `argv` is a list — no shell parses it — built from
|
||||
# this script's own scenarios and the developer's own --uv-exe; there is no other caller.
|
||||
return subprocess.run( # NOSONAR
|
||||
argv,
|
||||
cwd=cwd,
|
||||
env=env,
|
||||
|
||||
+2
-1
@@ -64,7 +64,8 @@ def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--out", type=Path, default=Path("spikes/out"))
|
||||
args = parser.parse_args()
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
# NOSONAR (S8707): a developer's measurement script writing where its developer says.
|
||||
args.out.mkdir(parents=True, exist_ok=True) # NOSONAR
|
||||
|
||||
print(f"fetching {SIMPLE_INDEX} …", flush=True)
|
||||
body, fetch_s, wire_bytes = fetch(SIMPLE_INDEX)
|
||||
|
||||
@@ -5,6 +5,7 @@ version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
|
||||
+3
-8
@@ -4,15 +4,10 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!--
|
||||
The development policy. `npm run dev` serves this file as-is, and Vite injects its CSS as
|
||||
<style> elements, so style-src needs 'unsafe-inline' here. A release build gets Tauri's
|
||||
policy from tauri.conf.json as well, which drops it - and two policies are both enforced,
|
||||
so the stricter one decides. Keep the other directives in step with tauri.conf.json.
|
||||
No Content-Security-Policy here, on purpose. A release build gets tauri.conf.json's
|
||||
`app.security.csp`, which Tauri injects; `npm run dev` gets `devCsp` from the same file,
|
||||
injected by vite.config.ts. Both live in one place, and the weaker one never ships.
|
||||
-->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self'; connect-src 'self' ipc: http://ipc.localhost; object-src 'none'; base-uri 'none'; form-action 'none'"
|
||||
/>
|
||||
<title>PipDock</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+32
-1
@@ -1,16 +1,47 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import type { Plugin } from 'vite'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
|
||||
/**
|
||||
* The development Content-Security-Policy, injected by `vite dev` and by nothing else.
|
||||
*
|
||||
* A release build's policy is `app.security.csp` in tauri.conf.json, which Tauri injects itself.
|
||||
* Development needs a looser `style-src` — Vite injects CSS as <style> elements — and that policy
|
||||
* used to sit in index.html, where it was shipped in every release build as a second meta tag:
|
||||
* harmless, since the stricter of two policies wins, but the weaker one was in the product. Read
|
||||
* from `devCsp`, so the two policies are kept side by side in one file.
|
||||
*/
|
||||
function devCsp(): Plugin {
|
||||
const conf = JSON.parse(
|
||||
readFileSync(new URL('./src-tauri/tauri.conf.json', import.meta.url), 'utf8'),
|
||||
) as { app: { security: { devCsp: string } } }
|
||||
return {
|
||||
name: 'pipdock-dev-csp',
|
||||
apply: 'serve',
|
||||
transformIndexHtml: () => [
|
||||
{
|
||||
tag: 'meta',
|
||||
attrs: { 'http-equiv': 'Content-Security-Policy', content: conf.app.security.devCsp },
|
||||
// After Vite's own head-prepend scripts (React Refresh's inline preamble), as the old
|
||||
// meta in index.html was: a meta policy governs what follows it, and the preamble is
|
||||
// dev-only tooling, not the app.
|
||||
injectTo: 'head',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
// The frontend lives in ui/ per ARCHITECTURE §2, but package.json sits at the repo root so the
|
||||
// ops-repo `reusable-web-react.yml` — which has no working-directory input — can run `npm ci` and
|
||||
// `npm run build` unmodified. Hence root: './ui' with the bundle emitted to the repo-root dist/,
|
||||
// which is that workflow's default dist-dir.
|
||||
export default defineConfig({
|
||||
root: './ui',
|
||||
plugins: [react(), tailwindcss()],
|
||||
plugins: [react(), tailwindcss(), devCsp()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./ui/src', import.meta.url)),
|
||||
|
||||
Reference in new issue
Block a user