From cd625bb0ffabd892687b0156f4cb6d2fd8d485fd Mon Sep 17 00:00:00 2001 From: Sumiran Aggarwal Date: Tue, 18 Feb 2020 12:33:35 +0530 Subject: [PATCH 1/2] Remove publish profile from logs --- lib/main.js | 2 +- package-lock.json | 65 +++++++------------- package.json | 4 +- src/ActionInputValidator/ValidatorFactory.ts | 2 +- src/main.ts | 2 +- 5 files changed, 28 insertions(+), 47 deletions(-) diff --git a/lib/main.js b/lib/main.js index 4c0639cc1..64d238b76 100644 --- a/lib/main.js +++ b/lib/main.js @@ -35,7 +35,7 @@ function main() { core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString); // Initialize action inputs let endpoint = !!core.getInput('publish-profile') ? null : yield AuthorizerFactory_1.AuthorizerFactory.getAuthorizer(); - let actionParams = actionparameters_1.ActionParameters.getActionParams(endpoint); + actionparameters_1.ActionParameters.getActionParams(endpoint); let type = null; if (!!endpoint) { type = BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN; diff --git a/package-lock.json b/package-lock.json index b36a56e58..5cbc33487 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,13 +81,13 @@ } }, "azure-actions-appservice-rest": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/azure-actions-appservice-rest/-/azure-actions-appservice-rest-1.0.8.tgz", - "integrity": "sha512-FWsFjLRvfPoIerTRj2yBpPlVHh7JbNXZc8Pv5eK4sN91LsLGhSPKjfnV+tbweLYdiEldglSQefaIoLHthn/06A==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/azure-actions-appservice-rest/-/azure-actions-appservice-rest-1.0.9.tgz", + "integrity": "sha512-/Ksj9wpn0GGSMJRaCCmjkO+51FHIjzIhU/zl9BjMSclo7BJT4I3Ge8Maa5aYIZGzYi4fUg+YzV/7uGsV/VPvTQ==", "requires": { "@actions/core": "^1.1.1", "@actions/io": "^1.0.1", - "azure-actions-webclient": "^1.0.8", + "azure-actions-webclient": "^1.0.11", "fs": "0.0.1-security", "util": "^0.12.1", "uuid": "^3.3.3", @@ -111,9 +111,9 @@ } }, "azure-actions-webclient": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/azure-actions-webclient/-/azure-actions-webclient-1.0.10.tgz", - "integrity": "sha512-5MJ6ls5XzzB903L3yLCekx+SDoTr8MbGw6EoDBOodwuIrKMpjbGTIUOI6nRkWvQayKxOEwTZ6Y+qECOknlXA9Q==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/azure-actions-webclient/-/azure-actions-webclient-1.0.11.tgz", + "integrity": "sha512-4l0V47W3DDreTFCXEdhWr9LhmgSZecWWyKhm06XOAUodQ82x9ndFFet4OywCDcvQ1u4Gh11xPaSv62FACcgyyw==", "requires": { "@actions/core": "^1.1.3", "@actions/exec": "^1.0.1", @@ -305,21 +305,21 @@ } }, "es-abstract": { - "version": "1.17.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0-next.1.tgz", - "integrity": "sha512-7MmGr03N7Rnuid6+wyhD9sHNE2n4tFSwExnU2lQl3lIo2ShXWGePY80zYaoMOmILWv57H0amMjZGHNzzGG70Rw==", + "version": "1.17.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz", + "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==", "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", "object-inspect": "^1.7.0", "object-keys": "^1.1.1", "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.0", - "string.prototype.trimright": "^2.1.0" + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" } }, "es-to-primitive": { @@ -447,9 +447,9 @@ "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==" }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==" }, "is-date-object": { "version": "1.0.2", @@ -580,15 +580,6 @@ "has": "^1.0.3" } }, - "object.getownpropertydescriptors": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", - "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -857,19 +848,10 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, "uuid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", - "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, "word-wrap": { "version": "1.2.3", @@ -882,12 +864,11 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "xml2js": { - "version": "0.4.22", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.22.tgz", - "integrity": "sha512-MWTbxAQqclRSTnehWWe5nMKzI3VmJ8ltiJEco8akcC6j3miOhjjfzKum5sId+CWhfxdOs/1xauYr8/ZDBtQiRw==", + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "requires": { "sax": ">=0.6.0", - "util.promisify": "~1.0.0", "xmlbuilder": "~11.0.0" } }, diff --git a/package.json b/package.json index ff752955a..074ac8968 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "dependencies": { "@actions/core": "^1.2.1", "actions-secret-parser": "^1.0.3", - "azure-actions-appservice-rest": "^1.0.8", + "azure-actions-appservice-rest": "^1.0.9", "azure-actions-utility": "^1.0.3", - "azure-actions-webclient": "^1.0.10" + "azure-actions-webclient": "^1.0.11" } } diff --git a/src/ActionInputValidator/ValidatorFactory.ts b/src/ActionInputValidator/ValidatorFactory.ts index da2aefbf9..5ab76e9ae 100644 --- a/src/ActionInputValidator/ValidatorFactory.ts +++ b/src/ActionInputValidator/ValidatorFactory.ts @@ -12,7 +12,7 @@ import { appNameIsRequired } from "./Validations"; export class ValidatorFactory { public static async getValidator(type: DEPLOYMENT_PROVIDER_TYPES) : Promise { - let actionParams = ActionParameters.getActionParams(); + let actionParams: ActionParameters = ActionParameters.getActionParams(); if(type == DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE) { return new PublishProfileWebAppValidator(); diff --git a/src/main.ts b/src/main.ts index 7b866f9ed..c8eacc796 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,7 +23,7 @@ async function main() { // Initialize action inputs let endpoint: IAuthorizer = !!core.getInput('publish-profile') ? null : await AuthorizerFactory.getAuthorizer(); - let actionParams: ActionParameters = ActionParameters.getActionParams(endpoint); + ActionParameters.getActionParams(endpoint); let type: DEPLOYMENT_PROVIDER_TYPES = null; if(!!endpoint) { From f2c418520085bf261305b57553ebd38a172589a0 Mon Sep 17 00:00:00 2001 From: Sumiran Aggarwal Date: Tue, 18 Feb 2020 13:16:17 +0530 Subject: [PATCH 2/2] ignore case for app name and slot --- lib/ActionInputValidator/Validations.js | 6 +++--- src/ActionInputValidator/Validations.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ActionInputValidator/Validations.js b/lib/ActionInputValidator/Validations.js index 16dc26d10..ba568fa9d 100644 --- a/lib/ActionInputValidator/Validations.js +++ b/lib/ActionInputValidator/Validations.js @@ -45,9 +45,9 @@ function validateAppDetails() { let actionParams = actionparameters_1.ActionParameters.getActionParams(); if (!!actionParams.appName || (!!actionParams.slotName && actionParams.slotName !== 'production')) { let creds = PublishProfile_1.PublishProfile.getPublishProfile(actionParams.publishProfileContent).creds; - let splitUsername = creds.username.substring(1).split("__"); - let appNameMatch = !actionParams.appName || actionParams.appName === splitUsername[0]; - let slotNameMatch = actionParams.slotName === 'production' || actionParams.slotName === splitUsername[1]; + let splitUsername = creds.username.toUpperCase().substring(1).split("__"); + let appNameMatch = !actionParams.appName || actionParams.appName.toUpperCase() === splitUsername[0]; + let slotNameMatch = actionParams.slotName === 'production' || actionParams.slotName.toUpperCase() === splitUsername[1]; if (!appNameMatch || !slotNameMatch) { throw new Error("Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app."); } diff --git a/src/ActionInputValidator/Validations.ts b/src/ActionInputValidator/Validations.ts index 434fef0de..fe733b3e5 100644 --- a/src/ActionInputValidator/Validations.ts +++ b/src/ActionInputValidator/Validations.ts @@ -33,9 +33,9 @@ export function validateAppDetails() { if(!!actionParams.appName || (!!actionParams.slotName && actionParams.slotName !== 'production')) { let creds: ScmCredentials = PublishProfile.getPublishProfile(actionParams.publishProfileContent).creds; - let splitUsername: string[] = creds.username.substring(1).split("__"); - let appNameMatch: boolean = !actionParams.appName || actionParams.appName === splitUsername[0]; - let slotNameMatch: boolean = actionParams.slotName === 'production' || actionParams.slotName === splitUsername[1]; + let splitUsername: string[] = creds.username.toUpperCase().substring(1).split("__"); + let appNameMatch: boolean = !actionParams.appName || actionParams.appName.toUpperCase() === splitUsername[0]; + let slotNameMatch: boolean = actionParams.slotName === 'production' || actionParams.slotName.toUpperCase() === splitUsername[1]; if(!appNameMatch || !slotNameMatch) { throw new Error("Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app."); }