Commit Graph
3 Commits
Author SHA1 Message Date
viyatb-oai a60197d6a0 Expose canonical network proxy policy patterns (#61351)
## What changed

Add `canonical_allow_pattern`, `canonical_deny_pattern`, and
`canonical_review_pattern` to validate and normalize selectors for policy
comparisons using the domain matcher's syntax.

Treat `?*.example.com` and `*.example.com` as equivalent comparison keys.
Canonicalize unscoped IPv6 addresses for deny and review rules, and preserve
wildcard ports on local allow rules so they remain distinguishable from explicit
local grants. Deny rules continue to reject global wildcards.

Share pattern validation with the matcher and local-literal classification with
runtime policy checks.

## Testing

Add a regression test covering equivalent subdomain selectors, local wildcard
ports, and differing IPv6 comparison keys for grants and restrictions.

GitOrigin-RevId: c72262ae9f625765d5351e9da403be1f87042a47
2026-11-13 18:49:23 +00:00
rafael-oai 14ff9c3a43 Preserve UTF-8 byte semantics in network domain matching (#52277)
## Why

Domain wildcards need to retain the byte-based behavior of `globset`. Counting Unicode scalar values changes how `?` matches non-ASCII hosts.

## What changed

Match domain patterns against UTF-8 bytes so `?` consumes exactly one byte. For example, `api??.com` matches `apié.com`. Match hosts through borrowed byte slices, avoiding the per-match character-vector allocation.

Document ASCII case insensitivity and the absence of IDNA conversion: hosts supplied as Punycode require patterns using their Punycode spelling.

## Testing

Compare Unicode wildcard cases against `globset` for both allowlists and denylists, including multibyte characters, combining marks, Punycode, and case sensitivity. Update the exhaustive dynamic-programming comparison and retry-boundary tests to operate on bytes.

GitOrigin-RevId: fae5b3b1ae60b469cd61a44c5c6e245730adc8ba
2026-10-08 21:09:30 +00:00
rafael-oai 529cd6b860 Use a dedicated matcher for network domain policies (#51897)
## Why

Network domain rules need explicit wildcard semantics independent of filesystem glob syntax, including matching Unicode hosts with `?`.

## What changed

Replace `globset` in network allowlist and denylist matching with a domain matcher. Make `?` consume one Unicode scalar value, retain ASCII case-insensitive matching and existing host normalization, and preserve the distinction between `*.example.com` and `**.example.com`.

Reject empty patterns, repeated wildcards outside the supported `**.` prefix, character classes, brace expansions, escapes, slashes, and embedded whitespace when loading policies. Continue allowing global wildcards only in allowlists.

## Testing

Add coverage for Unicode wildcard semantics, unsupported syntax, IPv6 normalization, invalid entries in either policy list, and adversarial matching inputs. Compare the matcher against an independent dynamic-programming implementation over exhaustive short inputs.

GitOrigin-RevId: 64f65fcda1a50998d70e046445d22cd2d2dcf27a
2026-10-08 01:12:42 +00:00