Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to hp (hittyping) will be documented in this file.

## [0.8.10] - 2026-11-15

### 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
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p align="center">
<a href="https://github.com/colangelo/HittyPing/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/colangelo/HittyPing/ci.yml?branch=main" alt="CI"></a>
<a href="https://github.com/colangelo/HittyPing/releases"><img src="https://img.shields.io/github/v/release/colangelo/HittyPing" alt="Release"></a>
<a href="https://goreportcard.com/report/github.com/colangelo/HittyPing"><img src="https://goreportcard.com/badge/github.com/colangelo/HittyPing" alt="Go Report"></a>
<a href="go.mod"><img src="https://img.shields.io/github/go-mod/go-version/colangelo/HittyPing" alt="Go version"></a>
<a href="https://scorecard.dev/viewer/?uri=github.com/colangelo/HittyPing"><img src="https://api.scorecard.dev/projects/github.com/colangelo/HittyPing/badge" alt="OpenSSF Scorecard"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
</p>
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 56 additions & 0 deletions fuzz_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
})
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/ac/hp
module github.com/colangelo/HittyPing

go 1.27.4

Expand Down
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading