diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 0be5a41571af..0cb72e978658 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -426,6 +426,7 @@ otherwise no tag is added. {issue}42208[42208] {pull}42403[42403] - Update CEL mito extensions to v1.21.0. {issue}40762[40762] {pull}45107[45107] - Add Fleet health status reporting to the entity analytics input. {issue}44269[44269] {pull}45152[45152] - Add Fleet status updating to o356audit input. {issue}44651[44651] {pull}44957[44957] +- Update CEL mito extensions to v1.22.0. {pull}45245[45245] *Auditbeat* diff --git a/NOTICE.txt b/NOTICE.txt index f6bdc7093313..bedf4087fecc 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -15556,11 +15556,11 @@ limitations under the License. -------------------------------------------------------------------------------- Dependency : github.com/elastic/mito -Version: v1.21.0 +Version: v1.22.0 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/mito@v1.21.0/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/mito@v1.22.0/LICENSE: Apache License diff --git a/go.mod b/go.mod index 4eeb6f69ddde..1402bfb10f3d 100644 --- a/go.mod +++ b/go.mod @@ -180,7 +180,7 @@ require ( github.com/elastic/go-freelru v0.16.0 github.com/elastic/go-quark v0.3.0 github.com/elastic/go-sfdc v0.0.0-20241010131323-8e176480d727 - github.com/elastic/mito v1.21.0 + github.com/elastic/mito v1.22.0 github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015 github.com/elastic/sarama v1.19.1-0.20250603175145-7672917f26b6 github.com/elastic/tk-btf v0.1.0 diff --git a/go.sum b/go.sum index 29ebbb529e8a..52ad7003532a 100644 --- a/go.sum +++ b/go.sum @@ -408,8 +408,8 @@ github.com/elastic/gopacket v1.1.20-0.20241002174017-e8c5fda595e6 h1:VgOx6omXIMK github.com/elastic/gopacket v1.1.20-0.20241002174017-e8c5fda595e6/go.mod h1:riddUzxTSBpJXk3qBHtYr4qOhFhT6k/1c0E3qkQjQpA= github.com/elastic/gosigar v0.14.3 h1:xwkKwPia+hSfg9GqrCUKYdId102m9qTJIIr7egmK/uo= github.com/elastic/gosigar v0.14.3/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/elastic/mito v1.21.0 h1:4Xr3D9pyjzxK/EnJooy9an/7jGXMhPCF2t+/O4GzDwQ= -github.com/elastic/mito v1.21.0/go.mod h1:h1V+8B62+DXsu0TstJkjsTh5ewJIDJlwzxPkP3HBM9s= +github.com/elastic/mito v1.22.0 h1:DW4RkO+PLwSbKVF5ijYzi0ug+TKzLL+DVJRzbOPbzQ0= +github.com/elastic/mito v1.22.0/go.mod h1:h1V+8B62+DXsu0TstJkjsTh5ewJIDJlwzxPkP3HBM9s= github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015 h1:z8cC8GASpPo8yKlbnXI36HQ/BM9wYjhBPNbDjAWm0VU= github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015/go.mod h1:qH9DX/Dmflz6EAtaks/+2SsdQzecVAKE174Zl66hk7E= github.com/elastic/pkcs8 v1.0.0 h1:HhitlUKxhN288kcNcYkjW6/ouvuwJWd9ioxpjnD9jVA= diff --git a/x-pack/filebeat/docs/inputs/input-cel.asciidoc b/x-pack/filebeat/docs/inputs/input-cel.asciidoc index 93cbe3933e80..2e9b40e070f3 100644 --- a/x-pack/filebeat/docs/inputs/input-cel.asciidoc +++ b/x-pack/filebeat/docs/inputs/input-cel.asciidoc @@ -1,7 +1,7 @@ [role="xpack"] :type: cel -:mito_version: v1.21.0 +:mito_version: v1.22.0 :mito_docs: https://pkg.go.dev/github.com/elastic/mito@{mito_version} [id="{beatname_lc}-input-{type}"] @@ -254,7 +254,7 @@ In addition to the extensions provided in the packages listed above, a global va Host environment variables are made available via the global map `env`. Only environment variables that have been allow listed via the `allowed_environment` configuration list are visible to the CEL program. -The CEL environment enables the https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes[optional types] library using the version defined {mito_docs}/lib#OptionalTypesVersion[here]. +The CEL environment enables the https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes[optional types] library using the version defined {mito_docs}/lib#OptionalTypesVersion[here] and the https://pkg.go.dev/github.com/google/cel-go/ext#TwoVarComprehensions[two-variable comprehensions extensions] library using the version defined {mito_docs}/lib#TwoVarComprehensionVersion[here]. Additionally, it supports authentication via Basic Authentication, Digest Authentication or OAuth2. diff --git a/x-pack/filebeat/input/cel/input.go b/x-pack/filebeat/input/cel/input.go index 6321e2ac7215..e6e580dbe925 100644 --- a/x-pack/filebeat/input/cel/input.go +++ b/x-pack/filebeat/input/cel/input.go @@ -38,6 +38,7 @@ import ( "github.com/google/cel-go/cel" "github.com/google/cel-go/common/decls" "github.com/google/cel-go/common/types" + "github.com/google/cel-go/ext" "google.golang.org/protobuf/types/known/structpb" v2 "github.com/elastic/beats/v7/filebeat/input/v2" @@ -1063,6 +1064,7 @@ func newProgram(ctx context.Context, src, root string, vars map[string]string, c opts := []cel.EnvOption{ cel.VariableDecls(decls.NewVariable(root, types.DynType)), cel.OptionalTypes(cel.OptionalTypesVersion(lib.OptionalTypesVersion)), + ext.TwoVarComprehensions(ext.TwoVarComprehensionsVersion(lib.OptionalTypesVersion)), lib.AWS(), lib.Collections(), lib.Crypto(), diff --git a/x-pack/filebeat/input/cel/input_test.go b/x-pack/filebeat/input/cel/input_test.go index fd398380694b..b73f16414158 100644 --- a/x-pack/filebeat/input/cel/input_test.go +++ b/x-pack/filebeat/input/cel/input_test.go @@ -496,6 +496,40 @@ var inputTests = []struct { {"message": "AWS4-HMAC-SHA256 Credential=id/20091110/region/service/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=ad27046c0009e06c6626e6009ba2af96027f4893b7a190ab67aaec85becb25cd"}, }, }, + { + // This test exists purely to demonstrate that the lib is available. + name: "optional_types_v2", + config: map[string]interface{}{ + "interval": 1, + "program": `{"events": [{ + "message": optional.unwrap([optional.of(42), optional.none()]).encode_json(), + }]}`, + "state": nil, + "resource": map[string]interface{}{ + "url": "", + }, + }, + want: []map[string]interface{}{ + {"message": "[42]"}, + }, + }, + { + // This test exists purely to demonstrate that the lib is available. + name: "two_var_comprehension_v2", + config: map[string]interface{}{ + "interval": 1, + "program": `{"events": [{ + "message": {'hello': 'world'}.transformMap(k, v, v + '!').encode_json(), + }]}`, + "state": nil, + "resource": map[string]interface{}{ + "url": "", + }, + }, + want: []map[string]interface{}{ + {"message": `{"hello":"world!"}`}, + }, + }, // FS-based tests. {