diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 0427f80..fd5dee6 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -21,7 +21,7 @@ jobs: with: persist-credentials: false - - uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 + - uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 with: results_file: results.sarif results_format: sarif diff --git a/CHANGELOG.md b/CHANGELOG.md index 21b4b77..f612454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to hp (hittyping) will be documented in this file. +## [0.8.9] - 2026-11-15 + +### Security + +- Container image builds with Go 1.27.4 (`golang:1.27-alpine`); the pinned 1.26 image was Go 1.26.3, which lacks stdlib fixes such as GO-2026-5026 and GO-2026-5942 (fixed in 1.26.6). Release binaries were already built with the latest stable Go +- `go` directive 1.26.2 → 1.27.4, so scanners no longer read the stdlib as vulnerable +- Bump `golang.org/x/crypto` 0.58.0 → 0.59.0 (GO-2026-5932, not reachable from hp), `x/sys` 0.50.0, `x/text` 0.44.0 +- CI: `ossf/scorecard-action` v2.4.0 → v2.5.0; v2.4.0 pulls its image from gcr.io, which now fails, so Scorecard had not run since before v0.8.7 and showed fixed advisories + +### Changed + +- `just verify-release` and `just verify-installed` download into a temp dir instead of the checkout; `just test-verify` checks it + ## [0.8.8] - 2026-11-15 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index 01901de..cae2773 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,6 +18,8 @@ just lint # Run golangci-lint just vuln # Run vulnerability check just ci # Local CI (lint, vuln, test) just clean # Remove binary +just verify-release # Download + cosign-verify the latest release (into a temp dir, never the checkout) +just test-verify # Check both verify recipes pass and leave the checkout unchanged (network, cosign) ``` Or directly with Go: @@ -85,7 +87,7 @@ HTTPS_PROXY=socks5://host:port hp cloudflare.com # Via SOCKS5 proxy ## Architecture -Go application using `spf13/pflag` for POSIX-style CLI flags. Uses latest stable Go (currently 1.26). +Go application using `spf13/pflag` for POSIX-style CLI flags. Uses latest stable Go (currently 1.27). Key functions: diff --git a/Dockerfile b/Dockerfile index 307c344..c30fe87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.26-alpine@sha256:91eda9776261207ea25fd06b5b7fed8d397dd2c0a283e77f2ab6e91bfa71079d AS builder +FROM golang:1.27-alpine@sha256:eb61c3873c97416fff0116553fff65d67a3549f72e11d9758849a689cdd8b523 AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download diff --git a/ROADMAP.md b/ROADMAP.md index b446769..51744cd 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -74,6 +74,12 @@ If hp evolves toward interactive features, consider migrating to [Bubble Tea](ht ## Completed +### v0.8.9 - Security Refresh + +- [x] Container image on Go 1.27.4; go directive 1.27.4; x/crypto v0.59.0 +- [x] Scorecard action v2.5.0 (gcr.io image pull was failing) +- [x] Verify recipes download into a temp dir + ### v0.8.8 - Fixed-Rate Sending & Agent Skill - [x] Fixed-rate sending like ping: one glyph per interval, also during outages; time-based loss % diff --git a/docs/release-protocol.md b/docs/release-protocol.md index d7e91c8..39dea1d 100644 --- a/docs/release-protocol.md +++ b/docs/release-protocol.md @@ -123,6 +123,9 @@ The release workflow will: # View the release command gh release view vX.Y.Z +# Verify the signed binary (downloads into a temp dir and prints its path) +just verify-release + # Check container image exists docker manifest inspect ghcr.io/colangelo/hp:vX.Y.Z diff --git a/go.mod b/go.mod index 182a72b..20037ef 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,16 @@ module github.com/ac/hp -go 1.26.2 +go 1.27.4 require ( github.com/quic-go/quic-go v0.65.0 github.com/spf13/pflag v1.0.10 - golang.org/x/sys v0.49.0 + golang.org/x/sys v0.50.0 ) require ( github.com/quic-go/qpack v0.6.0 // indirect - golang.org/x/crypto v0.58.0 // indirect + golang.org/x/crypto v0.59.0 // indirect golang.org/x/net v0.62.0 // indirect - golang.org/x/text v0.43.0 // indirect + golang.org/x/text v0.44.0 // indirect ) diff --git a/go.sum b/go.sum index 652cc99..9880f2c 100644 --- a/go.sum +++ b/go.sum @@ -12,11 +12,11 @@ go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= -golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c= +golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U= golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= -golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= -golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= -golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo= +golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY= diff --git a/justfile b/justfile index 27ea25f..d793605 100644 --- a/justfile +++ b/justfile @@ -64,10 +64,14 @@ verify-release: ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') BIN="hp-${OS}-${ARCH}" BASE_URL="https://github.com/colangelo/HittyPing/releases/latest/download" - echo "Downloading ${BIN}..." - curl -sLO "${BASE_URL}/${BIN}" - curl -sLO "${BASE_URL}/${BIN}.sig" - curl -sLO "${BASE_URL}/${BIN}.pem" + # just runs recipes in the repo root: download elsewhere, never into the checkout + TMP="${TMPDIR:-/tmp}" + DIR=$(mktemp -d "${TMP%/}/hp-verify-release.XXXXXX") + cd "$DIR" + echo "Downloading ${BIN} into ${DIR}..." + curl -fsSLO "${BASE_URL}/${BIN}" + curl -fsSLO "${BASE_URL}/${BIN}.sig" + curl -fsSLO "${BASE_URL}/${BIN}.pem" echo "Verifying signature..." cosign verify-blob \ --signature "${BIN}.sig" \ @@ -75,7 +79,8 @@ verify-release: --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp 'github.com/colangelo/HittyPing' \ "${BIN}" - echo "Verified! Binary: ${BIN}" + chmod +x "${BIN}" + echo "Verified! Binary: ${DIR}/${BIN}" # Bump version (major, minor, or patch) bump PART="patch": @@ -104,15 +109,32 @@ verify-installed: BIN="hp-${OS}-${ARCH}" BASE_URL="https://github.com/colangelo/HittyPing/releases/download/v${VERSION}" echo "Found: ${HP_PATH} (v${VERSION})" + # Signatures go to a temp dir that is removed even when verification fails + TMP="${TMPDIR:-/tmp}" + DIR=$(mktemp -d "${TMP%/}/hp-verify-installed.XXXXXX") + trap 'rm -rf "$DIR"' EXIT echo "Downloading signatures for ${BIN}..." - curl -sLO "${BASE_URL}/${BIN}.sig" - curl -sLO "${BASE_URL}/${BIN}.pem" + curl -fsSL -o "${DIR}/${BIN}.sig" "${BASE_URL}/${BIN}.sig" + curl -fsSL -o "${DIR}/${BIN}.pem" "${BASE_URL}/${BIN}.pem" echo "Verifying..." cosign verify-blob \ - --signature "${BIN}.sig" \ - --certificate "${BIN}.pem" \ + --signature "${DIR}/${BIN}.sig" \ + --certificate "${DIR}/${BIN}.pem" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp 'github.com/colangelo/HittyPing' \ "${HP_PATH}" - rm -f "${BIN}.sig" "${BIN}.pem" echo "Verified! ${HP_PATH} matches signed release v${VERSION}" + +# Check that verify-release and verify-installed leave the checkout untouched (needs network, cosign, an installed hp) +test-verify: + #!/usr/bin/env bash + set -euo pipefail + before=$(git status --porcelain --ignored) + out=$(just verify-release 2>&1) || { echo "$out"; echo "FAIL: verify-release exited non-zero"; exit 1; } + bin=$(printf '%s\n' "$out" | sed -n 's/^Verified! Binary: //p') + [[ -x "$bin" && "$bin" != "$PWD"/* ]] || { echo "$out"; echo "FAIL: binary '$bin' missing or inside the checkout"; exit 1; } + "$bin" --skill | grep -q '^name: hp$' || { echo "FAIL: downloaded binary does not print the skill"; exit 1; } + just verify-installed >/dev/null 2>&1 || { echo "FAIL: verify-installed exited non-zero"; exit 1; } + after=$(git status --porcelain --ignored) + [[ "$before" == "$after" ]] || { diff <(echo "$before") <(echo "$after"); echo "FAIL: the checkout changed"; exit 1; } + echo "PASS: both recipes verified and the checkout is unchanged (binary: $bin)" diff --git a/main.go b/main.go index a237009..0c404d9 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,7 @@ import ( // cleanly pause rendering before the process is actually stopped. var displayMu sync.Mutex -const version = "0.8.8" +const version = "0.8.9" //go:embed skills/hp/SKILL.md var skillText string