-
Notifications
You must be signed in to change notification settings - Fork 699
OCPBUGS-82140: Remove PII from events #16365
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -45,7 +45,7 @@ export const eventListener: TelemetryEventListener = async ( | |||||||||||||||||||||||||
| switch (eventType) { | ||||||||||||||||||||||||||
| case 'identify': | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| const { user, userResource, ...otherProperties }: TelemetryEventProperties = properties; | ||||||||||||||||||||||||||
| const { user, sandboxUserId, ...otherProperties }: TelemetryEventProperties = properties; | ||||||||||||||||||||||||||
| const clusterId = otherProperties?.clusterId; | ||||||||||||||||||||||||||
| const organizationId = otherProperties?.organizationId; | ||||||||||||||||||||||||||
| const username = user?.username; | ||||||||||||||||||||||||||
|
|
@@ -65,8 +65,7 @@ export const eventListener: TelemetryEventListener = async ( | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // anonymize user ID if cluster is not a DEVSANDBOX cluster | ||||||||||||||||||||||||||
| if (getClusterProperties().clusterType === 'DEVSANDBOX') { | ||||||||||||||||||||||||||
| processedUserId = | ||||||||||||||||||||||||||
| userResource?.metadata?.annotations?.['toolchain.dev.openshift.com/sso-user-id']; | ||||||||||||||||||||||||||
| processedUserId = sandboxUserId; | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| processedUserId = await anonymizeId(userId); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
67
to
71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add fallback when sandbox ID is missing in DEVSANDBOX identify path. At Line 68, Suggested fix- if (getClusterProperties().clusterType === 'DEVSANDBOX') {
- processedUserId = sandboxUserId;
- } else {
- processedUserId = await anonymizeId(userId);
- }
+ if (getClusterProperties().clusterType === 'DEVSANDBOX' && sandboxUserId) {
+ processedUserId = sandboxUserId;
+ } else {
+ processedUserId = await anonymizeId(userId);
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use some email parser to avoid processing strings which are not proper email addresses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to avoid introducing new dependencies for this given the need for a backport. This is also already good enough for non-emails, e.g.,
redhat.comormatt@hicks@redhat.comthis would return an empty string