Skip to content

Commit f8cedae

Browse files
feat: mask hostname in cli telemetry (#2416)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent aa4c66a commit f8cedae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cli/src/core/telemetry.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import crypto from 'node:crypto';
12
import os from 'node:os';
23
import { PostHog } from 'posthog-node';
34
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
@@ -149,13 +150,15 @@ export const captureCommandFailure = async (command: string, error: Error | stri
149150
* Get CLI metadata to include with all events
150151
*/
151152
const getMetadata = (): Record<string, any> => {
153+
const machineId = crypto.hash('sha256', os.hostname(), 'hex');
154+
152155
return {
153156
cli_version: config.version,
154157
node_version: process.version,
155158
os_name: process.platform,
156159
os_version: process.release?.name || '',
157160
platform: process.arch,
158-
machine_id: os.hostname(),
161+
machine_id: machineId,
159162
is_ci: isCI(),
160163
is_cosmo_cloud: isTalkingToCosmoCloud(),
161164
};

0 commit comments

Comments
 (0)