mirror of
https://github.com/cloudflare/cloudflared.git
synced 2026-11-17 19:26:14 +00:00
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
|
|
|---|---|---|
| .. | ||
| logger.go | ||
| metrics.go | ||
| proxy.go | ||
| proxy_posix_test.go | ||
| proxy_test.go | ||
| response_writer.go | ||
| response_writer_test.go | ||