handlePrefixDetail and handlePrefixDetailJSON in internal/server/handlers.go join the two path parts and pass the result to GetPrefixDetailsContext unchecked.
A malformed prefix, such as /api/v1/prefix/foo/24, makes GetPrefixDetailsContext fail with a parse error that is not ErrNoRoute, so both pages answer 500 and log it as a server error.
A valid prefix in any text form other than the one the tables store (the form Go's net/netip prints, see #48) is looked up as typed and answers 404 although the route exists: /api/v1/prefix/2001:DB8:0:0::/32 for a stored 2001:db8::/32, or /prefix/192.0.2.1/24 for 192.0.2.0/24.
Failure scenario: a client that writes IPv6 prefixes in full or in capitals gets "not found" for every route.
Severity: low
Definition of done
A test, failing before the fix: /api/v1/prefix/foo/24 answers 400; /api/v1/prefix/2001:DB8:0:0::/32 and /prefix/2001:DB8:0:0::/32 find a stored 2001:db8::/32; /api/v1/prefix/192.0.2.1/24 finds 192.0.2.0/24.
Both handlers parse the prefix with net/netip, mask it, and look up the text form it prints; a prefix that does not parse answers 400.
make check passes.
Model: opus-5-5
`handlePrefixDetail` and `handlePrefixDetailJSON` in `internal/server/handlers.go` join the two path parts and pass the result to `GetPrefixDetailsContext` unchecked.
- A malformed prefix, such as `/api/v1/prefix/foo/24`, makes `GetPrefixDetailsContext` fail with a parse error that is not `ErrNoRoute`, so both pages answer 500 and log it as a server error.
- A valid prefix in any text form other than the one the tables store (the form Go's `net/netip` prints, see https://git.eeqj.de/sneak/routewatch/issues/48) is looked up as typed and answers 404 although the route exists: `/api/v1/prefix/2001:DB8:0:0::/32` for a stored `2001:db8::/32`, or `/prefix/192.0.2.1/24` for `192.0.2.0/24`.
Failure scenario: a client that writes IPv6 prefixes in full or in capitals gets "not found" for every route.
Severity: low
## Definition of done
- A test, failing before the fix: `/api/v1/prefix/foo/24` answers 400; `/api/v1/prefix/2001:DB8:0:0::/32` and `/prefix/2001:DB8:0:0::/32` find a stored `2001:db8::/32`; `/api/v1/prefix/192.0.2.1/24` finds `192.0.2.0/24`.
- Both handlers parse the prefix with `net/netip`, mask it, and look up the text form it prints; a prefix that does not parse answers 400.
- `make check` passes.
Model: opus-5-5
clawbot
self-assigned this 2026-10-14 14:50:33 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
handlePrefixDetailandhandlePrefixDetailJSONininternal/server/handlers.gojoin the two path parts and pass the result toGetPrefixDetailsContextunchecked./api/v1/prefix/foo/24, makesGetPrefixDetailsContextfail with a parse error that is notErrNoRoute, so both pages answer 500 and log it as a server error.net/netipprints, see #48) is looked up as typed and answers 404 although the route exists:/api/v1/prefix/2001:DB8:0:0::/32for a stored2001:db8::/32, or/prefix/192.0.2.1/24for192.0.2.0/24.Failure scenario: a client that writes IPv6 prefixes in full or in capitals gets "not found" for every route.
Severity: low
Definition of done
/api/v1/prefix/foo/24answers 400;/api/v1/prefix/2001:DB8:0:0::/32and/prefix/2001:DB8:0:0::/32find a stored2001:db8::/32;/api/v1/prefix/192.0.2.1/24finds192.0.2.0/24.net/netip, mask it, and look up the text form it prints; a prefix that does not parse answers 400.make checkpasses.Model: opus-5-5