diff --git a/go.mod b/go.mod
index 4d03087..17dae69 100644
--- a/go.mod
+++ b/go.mod
@@ -4,21 +4,21 @@ go 1.27.1
require (
github.com/BurntSushi/toml v1.6.0
+ github.com/alecthomas/chroma/v2 v2.27.0
+ github.com/yuin/goldmark v1.8.6
+ golang.org/x/crypto v0.57.0
+ golang.org/x/term v0.46.0
modernc.org/sqlite v1.60.1
)
require (
- github.com/alecthomas/chroma/v2 v2.27.0 // indirect
github.com/dlclark/regexp2/v2 v2.2.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/mattn/go-isatty v0.0.24 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
- github.com/yuin/goldmark v1.8.6 // indirect
- golang.org/x/crypto v0.57.0 // indirect
golang.org/x/sys v0.48.0 // indirect
- golang.org/x/term v0.46.0 // indirect
modernc.org/libc v1.77.1 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.12.1 // indirect
diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go
index 8c22ccd..f94fe17 100644
--- a/internal/auth/auth_test.go
+++ b/internal/auth/auth_test.go
@@ -62,7 +62,8 @@ func TestAPIToken(t *testing.T) {
seen[token] = true
}
- if HashToken("sg_abc") != HashToken("sg_abc") {
+ tokenHash1, tokenHash2 := HashToken("sg_abc"), HashToken("sg_abc")
+ if tokenHash1 != tokenHash2 {
t.Error("HashToken is not deterministic")
}
if HashToken("sg_abc") == HashToken("sg_abd") {
diff --git a/internal/render/render.go b/internal/render/render.go
index 6ffbcb7..6e78938 100644
--- a/internal/render/render.go
+++ b/internal/render/render.go
@@ -45,8 +45,12 @@ func escapeHTMLBlock(w util.BufWriter, source []byte, node ast.Node, entering bo
func escapeRawHTML(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) {
if entering {
- if _, err := w.Write(util.EscapeHTML(node.Text(source))); err != nil {
- return ast.WalkStop, err
+ n := node.(*ast.RawHTML)
+ for i := range n.Segments.Len() {
+ segment := n.Segments.At(i)
+ if _, err := w.Write(util.EscapeHTML(segment.Value(source))); err != nil {
+ return ast.WalkStop, err
+ }
}
}
return ast.WalkSkipChildren, nil
diff --git a/internal/web/ratelimit_test.go b/internal/web/ratelimit_test.go
index 6b5f2bd..9fad64a 100644
--- a/internal/web/ratelimit_test.go
+++ b/internal/web/ratelimit_test.go
@@ -8,8 +8,11 @@ import (
func TestIPLimiterWindow(t *testing.T) {
limiter := newIPLimiter(2, time.Hour)
- if !limiter.allow("a") || !limiter.allow("a") {
- t.Fatal("first two hits for one key should be allowed")
+ if !limiter.allow("a") {
+ t.Fatal("first hit for one key should be allowed")
+ }
+ if !limiter.allow("a") {
+ t.Fatal("second hit for one key should be allowed")
}
if limiter.allow("a") {
t.Error("third hit within the window was allowed, want denied")
chore: lean-audit cleanups
Replace the deprecated goldmark node.Text call with per-segment access, fix a limiter test whose '||' short-circuited to a single hit, give a hash-determinism check distinct operands (staticcheck SA4000), and tidy go.mod so chroma/goldmark/x-crypto/x-term are direct imports.
c9e2c7d9d093eaef2426241c520fbf356c7bc00c
cjosie <administrator@josie-c.com> · 2026-10-16T18:13 ·
browse files at this commit
parents:
f4d054b