Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backports/willfindlay/1.0/redaction filters #2267

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

willfindlay
Copy link
Contributor

[upstream commit 69a4743]

Implement a new field filter type, the refaction filter. Redaction filters use regular expressions to suppress sensitive information in string fields in Tetragon events. When a regular expression in a redcation filter matches a string, everything inside of its capture groups is replaced with *****, effectively censoring the output. For example, the regular expression (?:--password|-p)(?:\s+|=)(\S*) will convert the string "--password=foo" into "--password=*****".

In some cases, it is not desirable to apply a redaction filter to all events. For this use case, redaction filters also include an event filter which can be used to select events to redact. This event filter is configured with the same syntax as an export filter. As a more concrete example:

{"match": {"binary_regex": ["^foo$"]}, "redact": ["\W(qux)\W"]}

The above filter would redact any occurrences of the word "qux" in events with the binary name "foo".

Due to the sensitive nature of redaction, these filters are applied as configured in the agent, regardless of whether an event is exported via gRPC or the JSON exporter. In other words, redaction filter configuration always happens at the agent config level, not in the gRPC client CLI.

Implement redaction filters to redact sensitive information from process events.

@willfindlay willfindlay added kind/backport This PR provides functionality previously merged into master. release-note/major This PR introduces major new functionality labels Mar 28, 2024
@willfindlay willfindlay requested review from a team and mtardy as code owners March 28, 2024 16:16
Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending of the Go tests results but this should be good, thanks! Maybe we should disable some of the tests for v1.0 since they might fail anyway (like the links or validated of generated files)

[upstream commit 69a4743]

Implement a new field filter type, the refaction filter. Redaction filters use regular
expressions to suppress sensitive information in string fields in Tetragon events. When
a regular expression in a redcation filter matches a string, everything inside of its
capture groups is replaced with `*****`, effectively censoring the output. For example,
the regular expression `(?:--password|-p)(?:\s+|=)(\S*)` will convert the string
"--password=foo" into "--password=*****".

In some cases, it is not desirable to apply a redaction filter to all events. For this use
case, redaction filters also include an event filter which can be used to select events to
redact. This event filter is configured with the same syntax as an export filter. As
a more concrete example:

    {"match": {"binary_regex": ["^foo$"]}, "redact": ["\W(qux)\W"]}

The above filter would redact any occurrences of the word "qux" in events with the binary
name "foo".

Due to the sensitive nature of redaction, these filters are applied as configured in the
agent, regardless of whether an event is exported via gRPC or the JSON exporter. In other
words, redaction filter configuration always happens at the agent config level, not in the
gRPC client CLI.

Signed-off-by: William Findlay <[email protected]>
@willfindlay willfindlay force-pushed the backports/willfindlay/1.0/redaction-filters branch from 2f50359 to e50a699 Compare April 2, 2024 14:10
@willfindlay
Copy link
Contributor Author

Maybe we should disable some of the tests for v1.0 since they might fail anyway (like the links or validated of generated files)

For the generated files, it was actually user error. I forgot to generate the docs for CLI flags.

I think it makes sense to disable links checker here though. For now let's ignore it.

@willfindlay
Copy link
Contributor Author

Shipping it

@willfindlay willfindlay merged commit 96c2bc6 into v1.0 Apr 2, 2024
29 of 30 checks passed
@willfindlay willfindlay deleted the backports/willfindlay/1.0/redaction-filters branch April 2, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/backport This PR provides functionality previously merged into master. release-note/major This PR introduces major new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants