From e938e8c6858e408b9fa6201730290db86171ab5f Mon Sep 17 00:00:00 2001 From: colangelo Date: Sun, 15 Nov 2026 17:40:55 +0100 Subject: [PATCH 1/4] fix: module path github.com/colangelo/HittyPing so go install works The module declared github.com/ac/hp, so the README's 'go install github.com/colangelo/HittyPing@latest' failed with 'module declares its path as github.com/ac/hp'. The path now matches the GitHub repository. Co-Authored-By: Claude Opus 5.5 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 20037ef..604bf88 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ac/hp +module github.com/colangelo/HittyPing go 1.27.4 From db0a85f1aa20b4f01a4304221b1a2d043826e309 Mon Sep 17 00:00:00 2001 From: colangelo Date: Sun, 15 Nov 2026 17:40:55 +0100 Subject: [PATCH 2/4] test: fuzz the stats-line truncation and host:port parsing Go native fuzz targets (FuzzTruncateToWidth, FuzzHostname), run with 'just fuzz'; 30 s each found nothing. Also satisfies Scorecard Fuzzing. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 1 + fuzz_test.go | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ justfile | 5 +++++ 3 files changed, 62 insertions(+) create mode 100644 fuzz_test.go diff --git a/CLAUDE.md b/CLAUDE.md index cae2773..a230f6d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,6 +20,7 @@ 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) +just fuzz # Fuzz the input parsers (30s each) ``` Or directly with Go: diff --git a/fuzz_test.go b/fuzz_test.go new file mode 100644 index 0000000..50dc68c --- /dev/null +++ b/fuzz_test.go @@ -0,0 +1,56 @@ +package main + +import ( + "net" + "regexp" + "strings" + "testing" +) + +var ansiEscape = regexp.MustCompile(`\x1b\[[^A-Za-z]*[A-Za-z]?`) + +func FuzzTruncateToWidth(f *testing.F) { + f.Add("0/5 ( 0%) lost; 12/30/88ms; last: 20ms", 20) + f.Add("\x1b[1m42\x1b[0m \x1b[90mms\x1b[0m", 3) + f.Add("\x1b[12", 1) + f.Add("", 0) + f.Fuzz(func(t *testing.T, s string, w int) { + got := truncateToWidth(s, w) + if w <= 0 { + if got != reset { + t.Fatalf("truncateToWidth(%q, %d) = %q; want only a reset", s, w, got) + } + return + } + body, _ := strings.CutSuffix(got, reset) + if !strings.HasPrefix(s, body) && !strings.HasPrefix(s, got) { + t.Fatalf("truncateToWidth(%q, %d) = %q; not a prefix of the input", s, w, got) + } + if visible := len(ansiEscape.ReplaceAllString(body, "")); visible > w { + t.Fatalf("truncateToWidth(%q, %d) = %q; %d visible bytes", s, w, got, visible) + } + if len(ansiEscape.ReplaceAllString(s, "")) <= w && got != s { + t.Fatalf("truncateToWidth(%q, %d) = %q; input fits and must come back unchanged", s, w, got) + } + }) +} + +func FuzzHostname(f *testing.F) { + f.Add("example.com", "8443") + f.Add("127.0.0.1", "80") + f.Add("::1", "443") + f.Add("", "1") + f.Fuzz(func(t *testing.T, host, port string) { + if strings.ContainsAny(host, "[]") || strings.ContainsAny(port, ":[]") { + t.Skip() + } + if got := hostname(net.JoinHostPort(host, port)); got != host { + t.Fatalf("hostname(%q) = %q; want %q", net.JoinHostPort(host, port), got, host) + } + if !strings.Contains(host, ":") { + if got := hostname(host); got != host { + t.Fatalf("hostname(%q) = %q; want it unchanged", host, got) + } + } + }) +} diff --git a/justfile b/justfile index d793605..283ac4e 100644 --- a/justfile +++ b/justfile @@ -33,6 +33,11 @@ fmt: lint: go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest run +# Fuzz the input parsers (30s each) +fuzz: + go test -run '^$' -fuzz '^FuzzTruncateToWidth$' -fuzztime 30s . + go test -run '^$' -fuzz '^FuzzHostname$' -fuzztime 30s . + # Run vulnerability check vuln: go run golang.org/x/vuln/cmd/govulncheck@latest ./... From 7bfd7b7f8480701cce48ce63622bc9156a940f9c Mon Sep 17 00:00:00 2001 From: colangelo Date: Sun, 15 Nov 2026 17:40:56 +0100 Subject: [PATCH 3/4] docs: replace retired Go Report Card badge, go install note, changelog Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 14 ++++++++++++++ README.md | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f612454..9bcfa61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to hp (hittyping) will be documented in this file. +## [Unreleased] + +### Fixed + +- `go install github.com/colangelo/HittyPing@latest` works: the module path was `github.com/ac/hp`, which does not match the repository, so the install failed with "module declares its path as". The binary installs as `HittyPing` + +### Added + +- Go native fuzz tests for the stats-line truncation and the host:port parsing (`just fuzz`) + +### Changed + +- README: the retired Go Report Card badge is replaced by a Go version badge + ## [0.8.9] - 2026-11-15 ### Security diff --git a/README.md b/README.md index 1393890..bfc3810 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

CI Release - Go Report + Go version OpenSSF Scorecard License

@@ -51,7 +51,7 @@ scoop install hp ### From source ```bash -go install github.com/colangelo/HittyPing@latest +go install github.com/colangelo/HittyPing@latest # installs the binary as HittyPing (v0.8.10+) # Or clone and build git clone https://github.com/colangelo/HittyPing.git From 46a7bd8e6f7edfb4805d62a420817606a2f1b90d Mon Sep 17 00:00:00 2001 From: colangelo Date: Sun, 15 Nov 2026 17:41:55 +0100 Subject: [PATCH 4/4] chore: prepare v0.8.10 release Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- ROADMAP.md | 6 ++++++ main.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bcfa61..45e501b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to hp (hittyping) will be documented in this file. -## [Unreleased] +## [0.8.10] - 2026-11-15 ### Fixed diff --git a/ROADMAP.md b/ROADMAP.md index 51744cd..f64ac64 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.10 - go install & Fuzzing + +- [x] Module path matches the repository, so `go install github.com/colangelo/HittyPing@latest` works +- [x] Go native fuzz tests (`just fuzz`) +- [x] Replace the retired Go Report Card badge + ### v0.8.9 - Security Refresh - [x] Container image on Go 1.27.4; go directive 1.27.4; x/crypto v0.59.0 diff --git a/main.go b/main.go index 0c404d9..07b41a7 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.9" +const version = "0.8.10" //go:embed skills/hp/SKILL.md var skillText string