urlutil

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package urlutil provides URL validation and integrity-hash utilities shared by config (agent entry validation) and harness (remote resource resolution) packages. It lives at the leaf of the import graph to avoid the config → harness circular dependency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsURL

func IsURL(s string) bool

IsURL returns true if s is a valid HTTPS URL suitable for remote resource references.

func MatchingAllowedPrefixInList

func MatchingAllowedPrefixInList(rawURL string, allowlist []string) string

MatchingAllowedPrefixInList checks if a URL matches any prefix in the given allowlist. Returns the matching prefix or "" if none match. Performs case-insensitive comparison with percent-decoding and dot-segment cleaning.

func NormalizeURLPath

func NormalizeURLPath(rawURL string) (string, bool)

NormalizeURLPath parses a URL, percent-decodes and cleans its path, and returns the reconstructed URL string. Returns false if parsing fails.

func ParseIntegrityHash

func ParseIntegrityHash(rawURL string) (cleanURL, hash string, hasHash bool)

ParseIntegrityHash extracts the SHA256 hash from a URL fragment (#sha256=...). Returns the URL without the fragment, the hash value, and whether a valid hash was found. The hash is normalized to lowercase; both "sha256=ABC..." and "sha256=abc..." are accepted.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL