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

Add filter_metadata config option #973

Merged
merged 1 commit into from
Jun 27, 2023
Merged

Add filter_metadata config option #973

merged 1 commit into from
Jun 27, 2023

Conversation

tombruijn
Copy link
Member

@tombruijn tombruijn commented Jun 26, 2023

We had a report of an app that contains sensitive information in the request path and the desire to filter this out. We have no system in place to filter metadata like path and request method, as set by the Sinatra middleware.

This change allow apps to filter out some metadata that's set by default, like path, to avoid sending PII or other sensitive data, using the filter_metadata config option.

Filtering is done with String based keys, like all the other filter_* config options are, so the keys need to be transformed to keys beforehand to make sure they're filtered out.

I didn't merge how we set the metadata, now it's set using Transaction#set_metadata and through sample_data when the Transaction is being sampled as sample data. I've left the behavior the same as much as possible to avoid breaking things.

See also this internal discussion: https://appsignal.slack.com/archives/CNPP953E2/p1687785270464119

To do

To do after merge

  • Document config option

@tombruijn tombruijn self-assigned this Jun 26, 2023
We had a report of an app that contains sensitive information in the
request path and the desire to filter this out. We have no system in
place to filter metadata like path and request method, as set by the
Sinatra middleware.

This change allow apps to filter out some metadata that's set by
default, like `path`, to avoid sending PII or other sensitive data,
using the `filter_metadata` config option.

Filtering is done with String based keys, like all the other `filter_*`
config options are, so the keys need to be transformed to keys
beforehand to make sure they're filtered out.

I didn't merge how we set the metadata, now it's set using
`Transaction#set_metadata` and through `sample_data` when the
Transaction is being sampled as sample data. I've left the behavior the
same as much as possible to avoid breaking things.

See also this internal discussion:
https://appsignal.slack.com/archives/CNPP953E2/p1687785270464119
@tombruijn tombruijn marked this pull request as ready for review June 26, 2023 13:32
tombruijn added a commit to appsignal/test-setups that referenced this pull request Jun 26, 2023
Added in PR appsignal/appsignal-ruby#973 in
favor of the `sinatra_sanitized_routes` option.
@unflxw
Copy link
Contributor

unflxw commented Jun 26, 2023

Nit: filter_tags? We don't use the word "metadata" to refer to them in our docs.

@tombruijn
Copy link
Member Author

tombruijn commented Jun 26, 2023

Nit: filter_tags? We don't use the word "metadata" to refer to them in our docs.

This doesn't filter tags though, even if the metadata appears in the tags box.

@unflxw
Copy link
Contributor

unflxw commented Jun 26, 2023

@tombruijn Oh! Today I learned there's a separate tag_request method for that: https://docs.appsignal.com/guides/custom-data/tagging-request.html

I think that, in the other integrations, there's no separate code paths for tags and metadata.

@tombruijn tombruijn merged commit e5e79d9 into main Jun 27, 2023
tombruijn added a commit to appsignal/test-setups that referenced this pull request Jun 28, 2023
Added in PR appsignal/appsignal-ruby#973 in
favor of the `sinatra_sanitized_routes` option.
tombruijn added a commit to appsignal/test-setups that referenced this pull request Jun 28, 2023
* Add example app for Sinatra sanitized routes

Add test route to Sinatra app to test the sanitized routes / route
definition to be set as the `path` metadata to avoid storing PII and
other sensitive data.

Related PR appsignal/appsignal-ruby#972

* Update config option to filter_metadata

Added in PR appsignal/appsignal-ruby#973 in
favor of the `sinatra_sanitized_routes` option.
@tombruijn tombruijn deleted the filter-metadata branch July 31, 2023 09:30
@tombruijn tombruijn restored the filter-metadata branch July 31, 2023 09:30
@tombruijn tombruijn deleted the filter-metadata branch July 10, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants