From 3d4101ecc0fab5d4f2a00a1819d0b2db7502d24c Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Mon, 26 Oct 2026 21:22:34 +0300 Subject: [PATCH] test: enforce release failure gates and record platform builds (#6) --- bible-local/07-dev.md | 2 ++ bible-local/issue-plan-2026-10-26.md | 12 +++++++++- scripts/tests/release-security.cjs | 33 ++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 scripts/tests/release-security.cjs diff --git a/bible-local/07-dev.md b/bible-local/07-dev.md index fa0d970..dbf1151 100644 --- a/bible-local/07-dev.md +++ b/bible-local/07-dev.md @@ -47,6 +47,8 @@ normal Go toolchain selection downloads a suitable compiler when necessary. The scanner version is pinned in the Makefile. All release build targets and `scripts/release.sh` require this check to succeed before producing artifacts. A scanner/database/download failure also stops release. +`node scripts/tests/release-security.cjs` verifies failure stops all release +entry points before artifact creation using an isolated failing scanner. When updating dependencies: run `go mod tidy`, `go test ./...`, `go vet ./...`, `make security-check` and the JavaScript regression check documented in diff --git a/bible-local/issue-plan-2026-10-26.md b/bible-local/issue-plan-2026-10-26.md index 4e7ab9c..89a4e1d 100644 --- a/bible-local/issue-plan-2026-10-26.md +++ b/bible-local/issue-plan-2026-10-26.md @@ -14,7 +14,7 @@ on `fix/issue-acceptance-and-migration-safety`. | 3 | [#7](https://git.mchus.pro/mchus/QuoteForge/issues/7) | Require a fresh verified archive outside rotation before reset, refuse unsynced/legacy states without explicit force, use transactional deletion, remove environment-triggered reset. Verified refusal, ZIP restore, backup failure, rollback and CLI startup after restore. | Acceptance passed | | 4 | [#5](https://git.mchus.pro/mchus/QuoteForge/issues/5) | Persist TLS mode/CA in SQLite, expose setup controls, share policy across setup/sync/migration DSNs. Verified certificate trust, hostname checks, fallback policy, settings round-trip and live MariaDB 11.8 transport. | Acceptance passed | | 5 | [#3](https://git.mchus.pro/mchus/QuoteForge/issues/3) | Keep each migration file in one session, execute verify headers before history insertion, propagate FK failures. Verify failed queries/checks never enter history. | Implemented | -| 6 | [#6](https://git.mchus.pro/mchus/QuoteForge/issues/6) | Require Go 1.27.3, update vulnerable dependencies, block release on pinned govulncheck. Full tests, vet, security scan and macOS/Windows builds must pass. | Implemented | +| 6 | [#6](https://git.mchus.pro/mchus/QuoteForge/issues/6) | Require Go 1.27.3, update vulnerable dependencies, block release on pinned govulncheck. Tests, vet, security scan, cross-platform builds and release failure checks pass. | Acceptance passed | ## Decisions @@ -91,3 +91,13 @@ Correct trust succeeds, unrelated roots and wrong hostname fail. Certificates, private keys and database storage are temporary; no saved user DSN is used. The matching image must already exist locally (`docker pull mariadb:11.8`). Setup policy, local settings and synthetic TLS tests also pass. + +### Issue #6 + +Go 1.27.3: `go test ./...`, `go vet ./...` and `make security-check` pass. +CGO-free builds produce macOS arm64 Mach-O and Windows amd64 PE executables +outside the repository. `node scripts/tests/release-security.cjs` substitutes a +failing Go scanner in an isolated directory and confirms all five release build +targets and `scripts/release.sh` stop before compilation or artifact creation. +The scanner reports zero reachable vulnerabilities and one uncalled module-level +advisory. No release is published by these acceptance checks. diff --git a/scripts/tests/release-security.cjs b/scripts/tests/release-security.cjs new file mode 100644 index 0000000..008bce8 --- /dev/null +++ b/scripts/tests/release-security.cjs @@ -0,0 +1,33 @@ +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const {spawnSync} = require('node:child_process'); + +const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'qfs-release-gate-')); +try { + fs.copyFileSync('Makefile', path.join(directory, 'Makefile')); + fs.copyFileSync('scripts/release.sh', path.join(directory, 'release.sh')); + const tools = path.join(directory, 'tools'); + fs.mkdirSync(tools); + fs.writeFileSync(path.join(tools, 'go'), '#!/bin/sh\nprintf "%s\\n" "$*" >> "$QFS_TEST_GO_CALLS"\nexit 23\n', {mode: 0o755}); + const callsPath = path.join(directory, 'calls'); + const env = {...process.env, PATH: tools + path.delimiter + process.env.PATH, QFS_TEST_GO_CALLS: callsPath}; + const cases = [ + ...['build-release', 'build-linux', 'build-macos', 'build-windows', 'build-all'].map(target => ['make', [target]]), + ['bash', ['release.sh']], + ]; + for (const [cmd, args] of cases) { + fs.writeFileSync(callsPath, ''); + const result = spawnSync(cmd, args, {cwd: directory, env, encoding: 'utf8', timeout: 10000}); + assert.ifError(result.error); + assert.notEqual(result.status, 0, `${cmd} ${args}: scanner failure was ignored`); + const calls = fs.readFileSync(callsPath, 'utf8').trim().split('\n'); + assert.deepEqual(calls, ['run golang.org/x/vuln/cmd/govulncheck@v1.9.0 ./...']); + assert(!fs.existsSync(path.join(directory, 'bin')), 'Build artifacts created after failed scan'); + assert(!fs.existsSync(path.join(directory, 'releases')), 'Release artifacts created after failed scan'); + } + console.log('Release security failure checks passed'); +} finally { + fs.rmSync(directory, {recursive: true, force: true}); +}