Skip to content

docs: slice binding example (#170) + JWT timing-attack caveat (#100)#417

Merged
vishr merged 1 commit into
masterfrom
docs-binding-slices-jwt-note
Jun 16, 2026
Merged

docs: slice binding example (#170) + JWT timing-attack caveat (#100)#417
vishr merged 1 commit into
masterfrom
docs-binding-slices-jwt-note

Conversation

@vishr

@vishr vishr commented Jun 16, 2026

Copy link
Copy Markdown
Member

Two small docs content fixes.

#170 — Document binding repeated query params to a slice

Struct-tag binding to a slice field wasn't documented (only the fluent binder showed it). Adds a Slices subsection to the binding guide:

// GET /search?tag=go&tag=web&tag=api
type Filter struct {
	Tags []string `query:"tag"`
}
// f.Tags == []string{"go", "web", "api"}

Across all 5 locales (heading + lead-in translated; code block identical).

#100 — JWT example timing attack

The cookbook login handler compared hard-coded credentials with a plain !=. Replaced the bare // Throws unauthorized error comment with a caveat that it's demo-only and that production code should verify a hashed password with a constant-time compare (e.g. bcrypt.CompareHashAndPassword) to avoid timing attacks. Comment is identical across all 5 locales (matching the docs' code-comment convention).

Verification

  • Build passes (301 pages).

Closes #170
Closes #100

🤖 Generated with Claude Code

…100)

#170 — Struct-tag binding to a slice field (repeated query/path/form/header
values collected into []T) was undocumented. Add a "Slices" subsection to the
binding guide with a `[]string` + repeated-query-param example, across all
five locales (translated heading/lead-in, identical code block).

#100 — The JWT cookbook login handler compared hard-coded credentials with a
plain `!=` and only a "// Throws unauthorized error" comment. Replace it with
a caveat noting it's demo-only and that production code should verify a hashed
password using a constant-time compare to avoid timing attacks (all locales).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vishr vishr merged commit 3f9e3e3 into master Jun 16, 2026
2 checks passed
@vishr vishr deleted the docs-binding-slices-jwt-note branch June 16, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document how to bind multiple instances of the same query param to a slice JWT Example shows timing attack

1 participant