@marcel91200 / caddy Mirror · read-only / commits / 23d07ac8
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 16:00 UTC

dep: upgrade cel-go (#7478)

* dep: upgrade cel-go Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com> * Try handling `map[any]any`, fix error messages --------- Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com> Co-authored-by: Francis Lavoie <lavofr@gmail.com>

Mohammed Al Sahaf committed Feb 16, 2026 at 21:25 UTC 23d07ac89dc3a28ff3114e1d8018d7beab479568
3 files changed +43 -7
go.mod
+3 -3
@@ -14,7 +14,7 @@ require (
14 github.com/cloudflare/circl v1.6.2
15 github.com/dustin/go-humanize v1.0.1
16 github.com/go-chi/chi/v5 v5.2.4
17 - github.com/google/cel-go v0.26.1
17 + github.com/google/cel-go v0.27.0
18 github.com/google/uuid v1.6.0
19 github.com/klauspost/compress v1.18.2
20 github.com/klauspost/cpuid/v2 v2.3.0
@@ -49,13 +49,13 @@ require (
49 )
50
51 require (
52 - cel.dev/expr v0.24.0 // indirect
52 + cel.dev/expr v0.25.1 // indirect
53 cloud.google.com/go/auth v0.18.1 // indirect
54 cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
55 cloud.google.com/go/compute/metadata v0.9.0 // indirect
56 dario.cat/mergo v1.0.2 // indirect
57 filippo.io/bigmod v0.1.0 // indirect
58 - github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
58 + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
59 github.com/ccoveille/go-safecast/v2 v2.0.0 // indirect
60 github.com/cenkalti/backoff/v5 v5.0.3 // indirect
61 github.com/coreos/go-oidc/v3 v3.17.0 // indirect
go.sum
+6
@@ -1,5 +1,7 @@
1 cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY=
2 cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
3 +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4=
4 +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
5 cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE=
6 cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU=
7 cloud.google.com/go/auth v0.18.1 h1:IwTEx92GFUo2pJ6Qea0EU3zYvKnTAeRCODxfA/G5UWs=
@@ -48,6 +50,8 @@ github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs
50 github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
51 github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
52 github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
53 +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
54 +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
55 github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
56 github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b h1:uUXgbcPDK3KpW29o4iy7GtuappbWT0l5NaMo9H9pJDw=
57 github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
@@ -168,6 +172,8 @@ github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
172 github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
173 github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ=
174 github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
175 +github.com/google/cel-go v0.27.0 h1:e7ih85+4qVrBuqQWTW4FKSqZYokVuc3HnhH5keboFTo=
176 +github.com/google/cel-go v0.27.0/go.mod h1:tTJ11FWqnhw5KKpnWpvW9CJC3Y9GK4EIS0WXnBbebzw=
177 github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
178 github.com/google/certificate-transparency-go v1.1.8-0.20240110162603-74a5dd331745 h1:heyoXNxkRT155x4jTAiSv5BVSVkueifPUm+Q8LUXMRo=
179 github.com/google/certificate-transparency-go v1.1.8-0.20240110162603-74a5dd331745/go.mod h1:zN0wUQgV9LjwLZeFHnrAbQi8hzMVvEWePyk+MhPOk7k=
modules/caddyhttp/celmatcher.go
+34 -4
@@ -665,12 +665,29 @@ func celMatcherJSONMacroExpander(funcName string) parser.MacroExpander {
665 // map literals containing heterogeneous values, in this case string and list
666 // of string.
667 func CELValueToMapStrList(data ref.Val) (map[string][]string, error) {
668 + // Prefer map[string]any, but newer cel-go versions may return map[any]any
669 mapStrType := reflect.TypeFor[map[string]any]()
670 mapStrRaw, err := data.ConvertToNative(mapStrType)
671 + var mapStrIface map[string]any
672 if err != nil {
671 - return nil, err
673 + // Try map[any]any and convert keys to strings
674 + mapAnyType := reflect.TypeFor[map[any]any]()
675 + mapAnyRaw, err2 := data.ConvertToNative(mapAnyType)
676 + if err2 != nil {
677 + return nil, err
678 + }
679 + mapAnyIface := mapAnyRaw.(map[any]any)
680 + mapStrIface = make(map[string]any, len(mapAnyIface))
681 + for k, v := range mapAnyIface {
682 + ks, ok := k.(string)
683 + if !ok {
684 + return nil, fmt.Errorf("unsupported map key type in header match: %T", k)
685 + }
686 + mapStrIface[ks] = v
687 + }
688 + } else {
689 + mapStrIface = mapStrRaw.(map[string]any)
690 }
673 - mapStrIface := mapStrRaw.(map[string]any)
691 mapStrListStr := make(map[string][]string, len(mapStrIface))
692 for k, v := range mapStrIface {
693 switch val := v.(type) {
@@ -685,13 +702,26 @@ func CELValueToMapStrList(data ref.Val) (map[string][]string, error) {
702 for i, elem := range val {
703 strVal, ok := elem.(types.String)
704 if !ok {
688 - return nil, fmt.Errorf("unsupported value type in header match: %T", val)
705 + return nil, fmt.Errorf("unsupported value type in matcher input: %T", val)
706 }
707 convVals[i] = string(strVal)
708 }
709 mapStrListStr[k] = convVals
710 + case []any:
711 + convVals := make([]string, len(val))
712 + for i, elem := range val {
713 + switch e := elem.(type) {
714 + case string:
715 + convVals[i] = e
716 + case types.String:
717 + convVals[i] = string(e)
718 + default:
719 + return nil, fmt.Errorf("unsupported element type in matcher input list: %T", elem)
720 + }
721 + }
722 + mapStrListStr[k] = convVals
723 default:
694 - return nil, fmt.Errorf("unsupported value type in header match: %T", val)
724 + return nil, fmt.Errorf("unsupported value type in matcher input: %T", val)
725 }
726 }
727 return mapStrListStr, nil