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-0419", # gtk3-macros — unmaintained
|
||||||
"RUSTSEC-2024-0420", # gtk-sys — unmaintained
|
"RUSTSEC-2024-0420", # gtk-sys — unmaintained
|
||||||
"RUSTSEC-2024-0429", # glib — unsound (VariantStrIter::impl_get); same GTK3 stack
|
"RUSTSEC-2024-0429", # glib — unsound (VariantStrIter::impl_get); same GTK3 stack
|
||||||
|
# A proc-macro, reached through glib-macros: the same stack, not a build dependency of
|
||||||
# --- Build-time only -----------------------------------------------------
|
# PipDock's as this file used to say (`cargo tree -i proc-macro-error --target all`).
|
||||||
# A proc-macro helper pulled in by a build dependency. It never reaches a shipped binary, and
|
|
||||||
# the advisory is "unmaintained", not a defect.
|
|
||||||
"RUSTSEC-2024-0370", # proc-macro-error — unmaintained
|
"RUSTSEC-2024-0370", # proc-macro-error — unmaintained
|
||||||
|
|
||||||
# --- unic-* Unicode tables ----------------------------------------------
|
# --- unic-* Unicode tables ----------------------------------------------
|
||||||
|
|||||||
+55
-7
@@ -4,10 +4,22 @@
|
|||||||
# ops repo, and that repo ships a dependabot-summary.yml, which makes Dependabot the portfolio
|
# ops repo, and that repo ships a dependabot-summary.yml, which makes Dependabot the portfolio
|
||||||
# standard.
|
# standard.
|
||||||
#
|
#
|
||||||
# Grouping intent carried over from the original spec: weekly grouped minor/patch PRs per
|
# Weekly grouped PRs per ecosystem, with Code Health's pins kept apart so a tool bump is reviewed
|
||||||
# ecosystem, and Code Health pins kept in their own group so they stay reviewable in isolation.
|
# on its own. Security advisories bypass grouping and schedule — that is Dependabot's default for
|
||||||
# Security advisories bypass grouping and schedule automatically — that is Dependabot's default
|
# security updates and cannot be configured away here.
|
||||||
# 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
|
version: 2
|
||||||
|
|
||||||
@@ -18,7 +30,13 @@ updates:
|
|||||||
interval: weekly
|
interval: weekly
|
||||||
day: monday
|
day: monday
|
||||||
open-pull-requests-limit: 5
|
open-pull-requests-limit: 5
|
||||||
|
cooldown:
|
||||||
|
default-days: 3
|
||||||
|
semver-major-days: 14
|
||||||
groups:
|
groups:
|
||||||
|
# First, so a Tauri crate never lands in the catch-all group below.
|
||||||
|
tauri:
|
||||||
|
patterns: ['tauri', 'tauri-*']
|
||||||
cargo-minor-patch:
|
cargo-minor-patch:
|
||||||
update-types: [minor, patch]
|
update-types: [minor, patch]
|
||||||
labels: [dependencies, rust]
|
labels: [dependencies, rust]
|
||||||
@@ -29,7 +47,17 @@ updates:
|
|||||||
interval: weekly
|
interval: weekly
|
||||||
day: monday
|
day: monday
|
||||||
open-pull-requests-limit: 5
|
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:
|
groups:
|
||||||
|
tauri:
|
||||||
|
patterns: ['@tauri-apps/*']
|
||||||
npm-minor-patch:
|
npm-minor-patch:
|
||||||
update-types: [minor, patch]
|
update-types: [minor, patch]
|
||||||
labels: [dependencies, frontend]
|
labels: [dependencies, frontend]
|
||||||
@@ -39,14 +67,34 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: weekly
|
||||||
day: monday
|
day: monday
|
||||||
|
cooldown:
|
||||||
|
default-days: 7
|
||||||
|
groups:
|
||||||
|
actions:
|
||||||
|
patterns: ['*']
|
||||||
labels: [dependencies, ci]
|
labels: [dependencies, ci]
|
||||||
|
|
||||||
# Code Health tool pins (deptry / vulture / ruff), shipped with the app and resolved at release
|
# Code Health tool pins (deptry / vulture / ruff / pip-audit), shipped with the app and resolved
|
||||||
# time — CODE-HEALTH-SPEC §2. Kept as its own ecosystem so a bump here is never bundled with
|
# at release time — CODE-HEALTH-SPEC §2. Its own ecosystem, so a bump here is never bundled with
|
||||||
# application dependencies.
|
# 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
|
- package-ecosystem: pip
|
||||||
directory: /tools
|
directory: /tools
|
||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: weekly
|
||||||
day: monday
|
day: monday
|
||||||
|
cooldown:
|
||||||
|
default-days: 7
|
||||||
|
groups:
|
||||||
|
code-health:
|
||||||
|
patterns: ['*']
|
||||||
labels: [dependencies, code-health]
|
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.
|
# against a real interpreter is only ever exercised here.
|
||||||
- 'crates/pipdock-core/src/probe.py'
|
- 'crates/pipdock-core/src/probe.py'
|
||||||
- 'crates/pipdock-core/src/health/**'
|
- '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/**'
|
- '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'
|
- 'spikes/capture.py'
|
||||||
# A Dependabot bump to the Code Health pins has to re-run the bootstrap: whether the new
|
# 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
|
# 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
|
# 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
|
# exists, then the build. It has no `npm audit` step, so that gate lives here — see
|
||||||
@@ -14,13 +14,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [main]
|
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:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ci-node-${{ github.ref }}
|
group: ci-node-${{ github.ref }}
|
||||||
@@ -29,6 +24,14 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
web:
|
web:
|
||||||
name: lint · typecheck · test · build
|
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
|
uses: poli0981/.github/.github/workflows/reusable-web-react.yml@main
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
@@ -44,6 +47,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
@@ -51,8 +56,25 @@ jobs:
|
|||||||
node-version: '24'
|
node-version: '24'
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
||||||
|
# The audit reads the lockfile; nothing is built, so no install script has a reason to run.
|
||||||
- name: Install
|
- name: Install
|
||||||
run: npm ci
|
run: npm ci --ignore-scripts
|
||||||
|
|
||||||
- name: Audit
|
- name: Audit
|
||||||
run: npm audit --audit-level=high
|
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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
# rust-toolchain.toml pins the exact version, so no toolchain action is needed — rustup
|
# 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.
|
# honours it on first invocation and installs rustfmt and clippy with it.
|
||||||
@@ -62,19 +64,47 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
env:
|
env:
|
||||||
# The action builds cargo-audit from source, and rust-toolchain.toml would otherwise pin
|
# cargo-audit only reads Cargo.lock, so it runs under the runner's stable cargo rather than
|
||||||
# that build to PipDock's toolchain. cargo-audit's own dependency tree already requires a
|
# making rustup install the toolchain rust-toolchain.toml pins — that pin exists to make
|
||||||
# newer rustc than we pin (kstring needs 1.96), so the audit failed to compile rather than
|
# PipDock reproducible, not its tooling.
|
||||||
# finding anything. It only reads Cargo.lock, so building it with stable is correct — the
|
|
||||||
# pin exists to make *PipDock* reproducible, not its tooling.
|
|
||||||
RUSTUP_TOOLCHAIN: stable
|
RUSTUP_TOOLCHAIN: stable
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
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:
|
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.
|
# Caller into the ops repo's CodeQL reusable.
|
||||||
#
|
#
|
||||||
# JavaScript/TypeScript only: CodeQL has no Rust analyzer, and the reusable's supported set is
|
# Three languages. **Rust** — CodeQL analyses it without a build (`build-mode: none`, which the
|
||||||
# csharp, python, javascript-typescript, ruby, c-cpp, java-kotlin, go and swift. Rust's static
|
# reusable passes for every language outside its autobuild list); this file said for six releases
|
||||||
# analysis is clippy `-D warnings` plus `cargo audit`, both blocking in ci-rust.yml.
|
# that CodeQL had no Rust support, which stopped being true in 2025. **Actions** — the workflows
|
||||||
# See docs/RELEASE-CI.md §1 and docs/SECURITY.md §7.
|
# 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
|
# The reusable notes that repo Settings → Advanced Security → CodeQL "Default setup" must be
|
||||||
# DISABLED, or this advanced-setup workflow is rejected at upload time.
|
# DISABLED, or this advanced-setup workflow is rejected at upload time.
|
||||||
@@ -32,4 +34,4 @@ jobs:
|
|||||||
analyze:
|
analyze:
|
||||||
uses: poli0981/.github/.github/workflows/reusable-codeql.yml@main
|
uses: poli0981/.github/.github/workflows/reusable-codeql.yml@main
|
||||||
with:
|
with:
|
||||||
languages: '["javascript-typescript"]'
|
languages: '["javascript-typescript", "rust", "actions"]'
|
||||||
@@ -1,13 +1,22 @@
|
|||||||
# Caller into the ops repo's Discord CI-failure notifier.
|
# Caller into the ops repo's Discord CI-failure notifier.
|
||||||
#
|
#
|
||||||
# The reusable skips workflows that have their own dedicated notifier (release, CodeQL,
|
# **Listed by name.** `workflows: ['*']`, which the ops repo's own example suggests, is not a
|
||||||
# Dependabot), so this does not double-report.
|
# 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
|
name: Notify CI Failure
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows: ['*']
|
workflows:
|
||||||
|
- CI / Rust
|
||||||
|
- CI / Node
|
||||||
|
- CI / Integration
|
||||||
|
- Security scan
|
||||||
types: [completed]
|
types: [completed]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
+109
-16
@@ -1,11 +1,20 @@
|
|||||||
# Project-local: the ops repo has no reusable Tauri/build workflow (docs/RELEASE-CI.md §1).
|
# 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
|
# Builds the NSIS .exe and .msi, attests where they were built, publishes SHA256SUMS.txt and leaves
|
||||||
# review. Publishing is manual on purpose — RELEASE-CI.md §3.4 — and announce-release.yml fires on
|
# a DRAFT release. Publishing is a separate, human-directed step (RELEASE-CI.md §3.4), and
|
||||||
# `release: published`.
|
# 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
|
# 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
|
name: Release
|
||||||
|
|
||||||
@@ -15,12 +24,17 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
tag:
|
||||||
description: Tag to build (for re-runs)
|
description: Tag to build (for re-runs). Empty builds the selected ref.
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
dry_run:
|
||||||
|
description: Build and checksum only — no attestation, no draft release.
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # release assets
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: release-${{ github.ref }}
|
group: release-${{ github.ref }}
|
||||||
@@ -31,14 +45,51 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build · checksum · draft
|
name: Build · checksum
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
outputs:
|
||||||
|
tag: ${{ steps.version.outputs.tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.tag || github.ref }}
|
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
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
@@ -79,21 +130,63 @@ jobs:
|
|||||||
ForEach-Object { Copy-Item $_.FullName $out }
|
ForEach-Object { Copy-Item $_.FullName $out }
|
||||||
Get-ChildItem $out
|
Get-ChildItem $out
|
||||||
|
|
||||||
- name: Publish checksums
|
- name: Checksums
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
# SmartScreen warns on first run because the binaries are not EV-code-signed, so the
|
# 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).
|
# 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' } |
|
Where-Object { $_.Name -ne 'SHA256SUMS.txt' } |
|
||||||
ForEach-Object { "$((Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()) $($_.Name)" } |
|
Sort-Object Name |
|
||||||
Set-Content release-artifacts\SHA256SUMS.txt -Encoding ascii
|
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
|
Get-Content release-artifacts\SHA256SUMS.txt
|
||||||
|
|
||||||
- name: Draft GitHub release
|
- name: Upload the build
|
||||||
uses: softprops/action-gh-release@v3
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ inputs.tag || github.ref_name }}
|
name: release-artifacts
|
||||||
draft: true # owner reviews, then publishes; publishing triggers the announcement
|
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
|
generate_release_notes: true
|
||||||
files: release-artifacts/*
|
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"
|
license = "GPL-3.0-only"
|
||||||
repository = "https://github.com/poli0981/pipdock"
|
repository = "https://github.com/poli0981/pipdock"
|
||||||
authors = ["Kokone (poli0981)"]
|
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]
|
[workspace.lints.rust]
|
||||||
unsafe_code = "forbid"
|
unsafe_code = "forbid"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ version.workspace = true
|
|||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ version.workspace = true
|
|||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
authors.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
|
* 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.
|
* 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
|
* Run by `npm run bundle` (package.json), which the release workflow calls too, so a local bundle
|
||||||
* `tauri build` and CI produce the same installer — a bundle that differs by who built it is how
|
* and CI produce the same installer — a bundle that differs by who built it is how "works on my
|
||||||
* "works on my machine" gets into a release.
|
* 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'
|
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. */
|
/** The host triple, asked of rustc rather than assumed — cross-compiling would break a guess. */
|
||||||
function hostTriple() {
|
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:'))
|
const line = out.split('\n').find((l) => l.startsWith('host:'))
|
||||||
if (line === undefined) throw new Error('rustc -vV printed no host line')
|
if (line === undefined) throw new Error('rustc -vV printed no host line')
|
||||||
return line.slice('host:'.length).trim()
|
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
|
// `--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.
|
// 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'], {
|
execFileSync('cargo', ['build', '--release', '--locked', '-p', 'pipdock-cli'], {
|
||||||
stdio: 'inherit',
|
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
|
env = None
|
||||||
if extra_env:
|
if extra_env:
|
||||||
env = {**os.environ, **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,
|
argv,
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
env=env,
|
env=env,
|
||||||
|
|||||||
+2
-1
@@ -64,7 +64,8 @@ def main() -> int:
|
|||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("--out", type=Path, default=Path("spikes/out"))
|
parser.add_argument("--out", type=Path, default=Path("spikes/out"))
|
||||||
args = parser.parse_args()
|
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)
|
print(f"fetching {SIMPLE_INDEX} …", flush=True)
|
||||||
body, fetch_s, wire_bytes = fetch(SIMPLE_INDEX)
|
body, fetch_s, wire_bytes = fetch(SIMPLE_INDEX)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ version.workspace = true
|
|||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|
||||||
|
|||||||
+3
-8
@@ -4,15 +4,10 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<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
|
No Content-Security-Policy here, on purpose. A release build gets tauri.conf.json's
|
||||||
<style> elements, so style-src needs 'unsafe-inline' here. A release build gets Tauri's
|
`app.security.csp`, which Tauri injects; `npm run dev` gets `devCsp` from the same file,
|
||||||
policy from tauri.conf.json as well, which drops it - and two policies are both enforced,
|
injected by vite.config.ts. Both live in one place, and the weaker one never ships.
|
||||||
so the stricter one decides. Keep the other directives in step with tauri.conf.json.
|
|
||||||
-->
|
-->
|
||||||
<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>
|
<title>PipDock</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
+32
-1
@@ -1,16 +1,47 @@
|
|||||||
|
import { readFileSync } from 'node:fs'
|
||||||
import { fileURLToPath, URL } from 'node:url'
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
|
||||||
|
import type { Plugin } from 'vite'
|
||||||
import { defineConfig } from 'vitest/config'
|
import { defineConfig } from 'vitest/config'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
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
|
// 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
|
// 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/,
|
// `npm run build` unmodified. Hence root: './ui' with the bundle emitted to the repo-root dist/,
|
||||||
// which is that workflow's default dist-dir.
|
// which is that workflow's default dist-dir.
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
root: './ui',
|
root: './ui',
|
||||||
plugins: [react(), tailwindcss()],
|
plugins: [react(), tailwindcss(), devCsp()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./ui/src', import.meta.url)),
|
'@': fileURLToPath(new URL('./ui/src', import.meta.url)),
|
||||||
|
|||||||
Reference in new issue
Block a user