Skip to content

Commit

Permalink
remove secret from debug logs (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisRumyantsev authored Aug 3, 2023
1 parent e123496 commit 3c8657e
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function run() {
googleutil.updateGlobalParams(globalParams, 'packageName', packageName);

console.log(tl.loc('Authenticating'));
await jwtClient.authorize();
await googleutil.authorize(jwtClient);
const edit = await googleutil.getNewEdit(edits, globalParams, packageName);
googleutil.updateGlobalParams(globalParams, 'editId', edit.id);

Expand Down
13 changes: 13 additions & 0 deletions Tasks/GooglePlayIncreaseRolloutV2/googleutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ export function getJWT(key: ClientKey): JWT {
return new google.auth.JWT(key.client_email, null, key.private_key, GOOGLE_PLAY_SCOPES, null);
}

export async function authorize(jwtClient: JWT): Promise<void> {
await jwtClient.authorize();

const credsToken: string = jwtClient.credentials.access_token;
const rawToken: string = jwtClient.gtoken.rawToken.access_token;

tl.setSecret(credsToken);

if (rawToken !== credsToken) {
tl.setSecret(rawToken);
}
}

/**
* Uses the provided JWT client to request a new edit from the Play store and attach the edit id to all requests made this session
* Assumes authorized
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayIncreaseRolloutV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"version": {
"Major": "2",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayIncreaseRolloutV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"version": {
"Major": "2",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayPromoteV3/google-play-promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function run() {
googleutil.updateGlobalParams(globalParams, 'packageName', packageName);

console.log(tl.loc('Authenticating'));
await jwtClient.authorize();
await googleutil.authorize(jwtClient);
const edit = await googleutil.getNewEdit(edits, globalParams, packageName);
googleutil.updateGlobalParams(globalParams, 'editId', edit.id);

Expand Down
13 changes: 13 additions & 0 deletions Tasks/GooglePlayPromoteV3/googleutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ export function getJWT(key: ClientKey): JWT {
return new google.auth.JWT(key.client_email, null, key.private_key, GOOGLE_PLAY_SCOPES, null);
}

export async function authorize(jwtClient: JWT): Promise<void> {
await jwtClient.authorize();

const credsToken: string = jwtClient.credentials.access_token;
const rawToken: string = jwtClient.gtoken.rawToken.access_token;

tl.setSecret(credsToken);

if (rawToken !== credsToken) {
tl.setSecret(rawToken);
}
}

/**
* Uses the provided JWT client to request a new edit from the Play store and attach the edit id to all requests made this session
* Assumes authorized
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayPromoteV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"version": {
"Major": "3",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayPromoteV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"version": {
"Major": "3",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayReleaseV4/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async function run(): Promise<void> {
const edits: pub3.Resource$Edits = googleutil.publisher.edits;

tl.debug('Authorize JWT.');
await jwtClient.authorize();
await googleutil.authorize(jwtClient);

console.log(tl.loc('GetNewEditAfterAuth'));
tl.debug('Creating a new edit transaction in Google Play.');
Expand Down
13 changes: 13 additions & 0 deletions Tasks/GooglePlayReleaseV4/modules/googleutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ export function getJWT(key: ClientKey): googleapis.Auth.JWT {
return new googleapis.Auth.JWT(key.client_email, null, key.private_key, GOOGLE_PLAY_SCOPES, null);
}

export async function authorize(jwtClient: googleapis.Auth.JWT): Promise<void> {
await jwtClient.authorize();

const credsToken: string = jwtClient.credentials.access_token;
const rawToken: string = jwtClient.gtoken.rawToken.access_token;

tl.setSecret(credsToken);

if (rawToken !== credsToken) {
tl.setSecret(rawToken);
}
}

/**
* Uses the provided JWT client to request a new edit from the Play store and attach the edit id to all requests made this session
* Assumes authorized
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayReleaseV4/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"demands": [],
"version": {
"Major": "4",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayReleaseV4/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"demands": [],
"version": {
"Major": "4",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function run() {
googleutil.updateGlobalParams(globalParams, 'packageName', packageName);

console.log(tl.loc('Authenticating'));
await jwtClient.authorize();
await googleutil.authorize(jwtClient);
const edit: androidpublisher_v3.Schema$AppEdit = await googleutil.getNewEdit(edits, globalParams, packageName);
googleutil.updateGlobalParams(globalParams, 'editId', edit.id);

Expand Down
13 changes: 13 additions & 0 deletions Tasks/GooglePlayStatusUpdateV2/googleutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ export function getJWT(key: ClientKey): JWT {
return new google.auth.JWT(key.client_email, null, key.private_key, GOOGLE_PLAY_SCOPES, null);
}

export async function authorize(jwtClient: JWT): Promise<void> {
await jwtClient.authorize();

const credsToken: string = jwtClient.credentials.access_token;
const rawToken: string = jwtClient.gtoken.rawToken.access_token;

tl.setSecret(credsToken);

if (rawToken !== credsToken) {
tl.setSecret(rawToken);
}
}

/**
* Uses the provided JWT client to request a new edit from the Play store and attach the edit id to all requests made this session
* Assumes authorized
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayStatusUpdateV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"version": {
"Major": "2",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GooglePlayStatusUpdateV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"version": {
"Major": "2",
"Minor": "220",
"Minor": "226",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down
2 changes: 1 addition & 1 deletion vsts-extension-google-play.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1.0,
"id": "google-play",
"name": "Google Play",
"version": "4.220.1",
"version": "4.226.0",
"publisher": "ms-vsclient",
"description": "Provides tasks for continuous delivery to the Google Play Store from TFS/Team Services build or release definitions",
"categories": [
Expand Down

0 comments on commit 3c8657e

Please sign in to comment.