8 Commits

Author SHA1 Message Date
Francis Lavoie
09b2cbcf4d
caddyhttp: Add MatchWithError to replace SetVar hack (#6596)
* caddyhttp: Add `MatchWithError` to replace SetVar hack

* Error in IP matchers on TLS handshake not complete

* Use MatchWithError everywhere possible

* Move implementations to MatchWithError versions

* Looser interface checking to allow fallback

* CEL factories can return RequestMatcherWithError

* Clarifying comment since it's subtle that an err is returned

* Return 425 Too Early status in IP matchers

* Keep AnyMatch signature the same for now

* Apparently Deprecated can't be all-uppercase to get IDE linting

* Linter
2024-11-04 23:18:50 +00:00
Francis Lavoie
792f1c7ed7
caddyhttp: Escaping placeholders in CEL, add vars and vars_regexp (#6594)
Some checks failed
Tests / test (./cmd/caddy/caddy.exe, ~1.22.3, windows-latest, True, 1.22, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.23.0, windows-latest, True, 1.23, windows) (push) Waiting to run
Lint / lint (macos-14, mac) (push) Waiting to run
Lint / lint (windows-latest, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.22.3, ubuntu-latest, 0, 1.22, linux) (push) Failing after 1m31s
Tests / test (./cmd/caddy/caddy, ~1.23.0, ubuntu-latest, 0, 1.23, linux) (push) Failing after 1m20s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Successful in 22s
Cross-Build / build (~1.22.3, 1.22, aix) (push) Successful in 1m32s
Cross-Build / build (~1.22.3, 1.22, darwin) (push) Successful in 1m33s
Cross-Build / build (~1.22.3, 1.22, dragonfly) (push) Successful in 1m29s
Cross-Build / build (~1.22.3, 1.22, freebsd) (push) Successful in 1m32s
Cross-Build / build (~1.22.3, 1.22, illumos) (push) Successful in 1m31s
Cross-Build / build (~1.22.3, 1.22, linux) (push) Successful in 1m30s
Cross-Build / build (~1.22.3, 1.22, netbsd) (push) Successful in 1m31s
Cross-Build / build (~1.22.3, 1.22, openbsd) (push) Successful in 1m28s
Cross-Build / build (~1.22.3, 1.22, solaris) (push) Successful in 1m30s
Cross-Build / build (~1.22.3, 1.22, windows) (push) Successful in 1m30s
Cross-Build / build (~1.23.0, 1.23, aix) (push) Successful in 1m20s
Cross-Build / build (~1.23.0, 1.23, darwin) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, dragonfly) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, freebsd) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, illumos) (push) Successful in 1m20s
Cross-Build / build (~1.23.0, 1.23, linux) (push) Successful in 1m20s
Cross-Build / build (~1.23.0, 1.23, netbsd) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, openbsd) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, solaris) (push) Successful in 1m20s
Cross-Build / build (~1.23.0, 1.23, windows) (push) Successful in 1m20s
Lint / lint (ubuntu-latest, linux) (push) Successful in 1m59s
Lint / govulncheck (push) Successful in 1m19s
* caddyhttp: Escaping placeholders in CEL

* Simplify some of the test cases

* Implement vars and vars_regexp in CEL

* dupl lint is dumb

* Better consts for the placeholder CEL shortcut

* Bump CEL version, register a few extensions

* Refactor s390x test script for readability

* Add retries for s390x to smooth over flakiness

* Switch to `ph` for the CEL shortcut (match it in templates cause why not)
2024-10-02 06:34:04 -06:00
Francis Lavoie
9cd472c031
caddyfile: Populate regexp matcher names by default (#6145)
* caddyfile: Populate regexp matcher names by default

* Some lint cleanup that my VSCode complained about

* Pass down matcher name through expression matcher

* Compat with #6113: fix adapt test, set both styles in replacer
2024-04-17 12:19:14 -06:00
Francis Lavoie
8c2a72ad07
matchers: Drop forwarded option from remote_ip matcher (#6085) 2024-02-07 10:09:29 -05:00
Tristan Swadell
10f85558ea
Expose several Caddy HTTP Matchers to the CEL Matcher (#4715)
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2022-06-22 18:53:46 -04:00
Matthew Holt
1498132ea3
caddyhttp: Log error from CEL evaluation (fix #4832) 2022-06-08 16:42:24 -06:00
v-rosa
514eef33fe
caddyhttp: Add support to resolve DN in CEL expression (#3608) 2020-07-31 15:06:30 -06:00
Mohammed Al Sahaf
d7dbf85525
cel: fix validation of expression result type (#3526)
* cel: fix validation of expression result type

The earlier code used the proto.Equals from github.com/gogo/protobuf, which failed to compare two messages of the same type for some reason. Switching to proto.Equal from the canonical github.com/golang/protobuf fixes the issue.

* deps: remove deprecated github.com/golang/protobuf in favor of google.golang.org/protobuf

* downgrade github.com/smallstep/nosql to resolve warning pb.proto warning
2020-06-30 11:53:29 -06:00