From f86425d665cd813a1017a69d1eca882d4714fb52 Mon Sep 17 00:00:00 2001 From: Usha N Date: Wed, 21 Oct 2020 10:25:56 +0530 Subject: [PATCH] Updating telemetry to remove Hashing of repo name (#66) * Updating telemetry to remove Hashing of repo name We have CELA sign off to log user name in telemetry instead of a Hash.. It will also help us map repo names with Azure subscriptions directly. * Update main.ts * adding lib/main.js * adding main.ts Co-authored-by: Ashish Ranjan Co-authored-by: aksm-ms <58936966+aksm-ms@users.noreply.github.com> --- lib/main.js | 3 +-- src/main.ts | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 8aeed1bf..194af6a2 100644 --- a/lib/main.js +++ b/lib/main.js @@ -17,7 +17,6 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(require("@actions/core")); -const crypto = __importStar(require("crypto")); const exec = __importStar(require("@actions/exec")); const io = __importStar(require("@actions/io")); const actions_secret_parser_1 = require("actions-secret-parser"); @@ -30,7 +29,7 @@ function main() { try { // Set user agent variable var isAzCLISuccess = false; - let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex'); + let usrAgentRepo = `${process.env.GITHUB_REPOSITORY}`; let actionName = 'AzureLogin'; let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`; let azurePSHostEnv = (!!azPSHostEnv ? `${azPSHostEnv}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`; diff --git a/src/main.ts b/src/main.ts index cbe0b20e..cd355f0e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,4 @@ import * as core from '@actions/core'; -import * as crypto from "crypto"; import * as exec from '@actions/exec'; import * as io from '@actions/io'; @@ -14,7 +13,7 @@ async function main() { try { // Set user agent variable var isAzCLISuccess = false; - let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex'); + let usrAgentRepo = `${process.env.GITHUB_REPOSITORY}`; let actionName = 'AzureLogin'; let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`; let azurePSHostEnv = (!!azPSHostEnv ? `${azPSHostEnv}+` : '') + `GITHUBACTIONS/${actionName}@v1_${usrAgentRepo}`; @@ -69,4 +68,4 @@ async function executeAzCliCommand(command: string, silent?: boolean) { } } -main(); \ No newline at end of file +main();