Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

telemetry ids should be obscured in log #57

Merged
merged 3 commits into from
Aug 26, 2022

Conversation

Hoverbear
Copy link
Contributor

@Hoverbear Hoverbear commented Aug 24, 2022

(Draft atop #55)

We don't want users to accidentally reveal their user data to us if they're asking for help, so we redact it in logs.

image
image

@Hoverbear Hoverbear self-assigned this Aug 24, 2022
@linear
Copy link

linear bot commented Aug 24, 2022

DS-267 telemetry IDs should be obscured in log output

If we ask users to copy paste logs with trace log levels, we'll get their distinct ID. Since that ID is personal, we'd rather not make it identifying. How about we obscure it for logging?

let res = req.send().await?;
tracing::debug!(telemetry = %header_data, "Sent telemetry data to {TELEMETRY_REMOTE_URL}");
tracing::debug!(telemetry = %self.redact_header_data(header_data.clone()), "Sent telemetry data to {TELEMETRY_REMOTE_URL}");
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it would be worth it to manually implement whatever this (%) is using (Display? Debug? maybe even both?) and redact the distinct ID there (which would necessitate a type / newtype wrapper for it, probably).

Otherwise, if we ever print out this header_data somewhere else, we'll have to remember this function exists and to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

% is shorthand for Display. ? is shorthand for debug.

I played with wrapping the type a bit yeah. tokio-rs/valuable#75 would make this quite easy. 😅

Copy link
Member

Choose a reason for hiding this comment

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

@grahamc
Copy link
Member

grahamc commented Aug 26, 2022

Looks like this needs a rebase. I'm also interested in some sort of separation of "this is an explicit request for unredacted data" and "gonna print this out".

One option could be that Telemetry has the data portion split out where Telemetry has a TelemetryData, which has a ->redacted() and ->unredacted() as accessors. What do you think about this?

If you consider this "gold plating" I'd be amenable to that.

@cole-h
Copy link
Member

cole-h commented Aug 26, 2022

I'd also be willing to tackle that as part of another PR, so we can get this merged sooner rather than later.

Ana had an idea of making the distinct_id an Option and then sending the request using something like with_distinct_id(), so that it's usually not present.

@Hoverbear
Copy link
Contributor Author

I'll rebase this now and we can merge it

@Hoverbear Hoverbear marked this pull request as ready for review August 26, 2022 15:27
@cole-h cole-h enabled auto-merge August 26, 2022 15:29
@cole-h cole-h merged commit 9487138 into main Aug 26, 2022
@grahamc grahamc deleted the hoverbear/ds-267-telemetry-ids-should-be-obscured-in-log branch August 26, 2022 15:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants