registry/internal/validators
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Radoslav Dimitrov 78b7bbde07
fix(validators): reject HTML metacharacters and whitespace in websiteUrl (#1249)
`validateWebsiteURL` only checked that the URL parses, is absolute, and
uses the `https` scheme. It accepted literal `"`, `'`, `<`, `>`, and
ASCII space — none of which are valid in a URI per RFC 3986, and all of
which broke rendering when the value flowed into the catalogue UI's
`<a href="...">` template.

Add a `strings.IndexAny` check after the scheme check that rejects any
of these characters with a clear `website-url-invalid-characters` issue
that points at the offending byte position. Control characters (`\t`,
`\n`, `\r`) are also covered: they're caught one step earlier by Go's
`url.Parse`, but the bytes are listed in the rejection set so the
behaviour is explicit and survives any future relaxation of `url.Parse`.
Already-percent-encoded URLs (e.g. `?q=hello%20world`) continue to
validate cleanly.

Adds table-driven cases for `"`, `'`, `<>`, space, newline, and a
positive case for percent-encoded special characters.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 09:26:50 -04:00
..
registries security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
schemas security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
constants.go feat: Add LocalTransport/RemoteTransport with URL template variables (#570) 2025-12-11 09:17:32 -08:00
package.go Add registry validators (#350) 2025-09-04 22:45:59 +01:00
schema.go Stop pinning Go to patch versions, use stable in CI (#1137) 2026-04-09 11:57:21 -04:00
schema_regex_test.go update schema url point to the actual location (#884) 2026-02-10 13:32:58 -08:00
schema_test.go Enhanced server.json validation (phase 1) (#636) 2026-01-16 00:49:39 +02:00
utils.go feat: Add LocalTransport/RemoteTransport with URL template variables (#570) 2025-12-11 09:17:32 -08:00
validation_detailed_test.go Enhanced server.json validation (phase 1) (#636) 2026-01-16 00:49:39 +02:00
validation_types.go Enhanced server.json validation (phase 1) (#636) 2026-01-16 00:49:39 +02:00
validation_types_test.go Enhanced server.json validation (phase 1) (#636) 2026-01-16 00:49:39 +02:00
validators.go fix(validators): reject HTML metacharacters and whitespace in websiteUrl (#1249) 2026-05-04 09:26:50 -04:00
validators_test.go fix(validators): reject HTML metacharacters and whitespace in websiteUrl (#1249) 2026-05-04 09:26:50 -04:00