-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support tagged fields and taggable (#60)
* fix (filters/encrypt): make a copy of the event data before modifying it since the node will be modifying the event data (aka redact/encrypt), we need our own copy, otherwise we could be changing the event across other pipelines and nodes and creating a host of problems and race conditions. * fix (filters/encrypt): skip non-exported fields When filtering fields, skip the non-exported fields which will significantly improve prerformance when dealing with things like protobufs which can have MANY unexported fields with MANY values. * feat (filters/encrypt): add support for filtering structpb.Value Add support for tagging maps which are google.protobuf.Struct and use structpb.Value for their values. * feat (filters/encrypt): support structs with tagged fields and taggable interface Support structs that have both tagged fields and have also implemented the Taggable interface for its fields which are maps * fix (filters/encrypt): fix check for top level Taggable interface We need to check if the top level payload interface{} for an event is Taggable before we strip off the interface to the underlying value. * test (filters/encrypt): Add tests for protobuf payloads * feat (filters/encrypt): Support filtering proto string/btye wrappers * fix (filters/encrypt): Properly support Taggable filter operations The initial implementation of Taggable required the all impl. of Taggable to return the filter operation for each tagged field and ignored the node's configured and overridden filter operations. This fixes that issue. Going fwd the impl. of Taggable "may" optionally return a filter op, and if none is returned the node's filter operations and/or overrides are used.
- Loading branch information
Showing
14 changed files
with
992 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
THIS_FILE := $(lastword $(MAKEFILE_LIST)) | ||
THIS_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
|
||
TMP_DIR := $(shell mktemp -d) | ||
REPO_PATH := github.com/hashicorp/eventlogger/filters/encrypt | ||
|
||
|
||
# currently, protobufs are only used for testing the filtering of event payloads | ||
# which include protobufs. | ||
proto: protobuild | ||
|
||
protobuild: | ||
# To add a new directory containing a proto pass the proto's root path in | ||
# through the --proto_path flag. | ||
@bash scripts/protoc_gen_plugin.bash \ | ||
"--proto_path=testing/proto" \ | ||
"--plugin_name=go" \ | ||
"--plugin_out=${TMP_DIR}" | ||
# Move the generated files from the tmp file subdirectories into the current | ||
# repo. | ||
cp -R ${TMP_DIR}/${REPO_PATH}/* ${THIS_DIR} | ||
|
||
# inject classification/filter tags | ||
@protoc-go-inject-tag -input=./testing/resources/protopayload/proto_payload.pb.go | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.