Expand description
Shape guards for untrusted strings that ride in URL path segments against the pakx-registry backend.
The registry’s RFC 3986 minimal percent-encoder
(urlencoding_minimal in the registry client + commands/info.rs)
leaves . in the unreserved set per the spec — which means a string
of literally .. produces a URL with a literal .. segment that a
normalizing reverse proxy (CDN, ALB, nginx with merge_slashes off)
collapses upward, silently re-routing the call to the wrong
endpoint. The encoder is doing the right thing; we need a separate
shape guard on every input that lands inside a URL path segment
before encoding.
Two guards live here:
validate_package_name— for<name>segments (and reused via the registry client’s own copy of the same logic).validate_version— for<version>segments. Stricter than the name guard because semver versions have a well-defined character set ([a-zA-Z0-9._+-]{1,64}covers exact pins, build metadata, and pre-release tags).
Both share the same error type so callers can route either through
a single match arm in the CLI’s error rendering.
Structs§
- Validation
Error - Shape-guard failure for a string destined for a URL path segment.
Constants§
- MAX_
VERSION_ LEN - Maximum number of characters in a validated version segment.
Functions§
- validate_
package_ name - Reject hostile package names before they reach the URL builder.
- validate_
version - Reject hostile version pins before they reach the URL builder.