- 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>
72 lines
2.7 KiB
TypeScript
72 lines
2.7 KiB
TypeScript
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(), devCsp()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./ui/src', import.meta.url)),
|
|
},
|
|
},
|
|
build: {
|
|
outDir: '../dist',
|
|
emptyOutDir: true,
|
|
// Tauri ships its own WebView2; there is no legacy browser to support.
|
|
target: 'esnext',
|
|
// No source maps: Tauri embeds dist/ in the executable, so `sourcemap: true` shipped 2 MB of
|
|
// them to every user, and nothing in a release build ever reads one (X51).
|
|
sourcemap: false,
|
|
},
|
|
server: {
|
|
port: 1420,
|
|
// Fail loudly rather than silently moving ports — tauri.conf.json pins devUrl to 1420.
|
|
strictPort: true,
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: [fileURLToPath(new URL('./ui/src/test/setup.ts', import.meta.url))],
|
|
include: ['ui/src/**/*.test.{ts,tsx}'],
|
|
root: fileURLToPath(new URL('.', import.meta.url)),
|
|
},
|
|
})
|