cloudflared/proxy
Miguel da Costa Martins Marcelino 3106f9499d VULN-170057: Don't bypass access with matrix parameters
Adding ingress parsing to cover matrix-path parameters. That is, paths that are delimited by semicolons. As an example, with the current normalization logic a path like /public/.;x/../admin would be normalized to /public/admin, which matches the non-Access /public rule. The new parsing logic prevents this from happening by always matching the access /admin path.

Rule matching now receives the request's URL so it can use the escaped path when normalization is enabled. URL.Path is already percent-decoded, so it cannot distinguish literal separators from encoded separators inside parameter values. For example, /admin;x=%2f..%2fpublic becomes /admin;x=/../public. Stripping parameters from that decoded path and then cleaning it incorrectly produces /public. Using URL.EscapedPath() lets us strip the parameter value first, producing /admin. When normalization is disabled, matching continues to use URL.Path.

Because path normalization now involves several steps, I refactored the code into a "pipeline" that applies transformations sequentially. This should clarify the purpose of each step.

The included tests should cover all scenarios: backslashes, trailing dots, repeated slashes, and semicolons.
History 2026-11-04 17:21:49 +00:00
..
logger.go TUN-8692: remove dashes from session id 2024-10-25 05:45:24 -07:00
metrics.go TUN-8224: Count and collect metrics on stream connect successes/errors 2024-02-07 14:38:21 +00:00
proxy.go VULN-170057: Don't bypass access with matrix parameters 2026-11-04 17:21:49 +00:00
proxy_posix_test.go TUN-7584: Bump go 1.20.6 2023-07-26 13:52:40 -07:00
proxy_test.go TUN-10808: Cancel QUIC reads when request bodies close 2026-09-24 17:19:13 +01:00
response_writer.go chore: Protect headers before flush 2026-09-23 15:58:37 +00:00
response_writer_test.go chore: Protect headers before flush 2026-09-23 15:58:37 +00:00