From 68efea2f7e9f9e9a19d24fa7ecb87a4020798a31 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Mon, 19 Feb 2024 15:08:55 +0530 Subject: [PATCH 1/2] replaced pseudoRandomBytes with randomBytes and version bump --- package-lock.json | 32 +++++++++---------- packages/contentstack-audit/package.json | 2 +- packages/contentstack-auth/package.json | 2 +- packages/contentstack-bootstrap/package.json | 2 +- packages/contentstack-branches/package.json | 2 +- .../contentstack-bulk-publish/package.json | 2 +- packages/contentstack-clone/package.json | 2 +- packages/contentstack-command/package.json | 2 +- packages/contentstack-config/package.json | 2 +- .../contentstack-export-to-csv/package.json | 2 +- packages/contentstack-export/package.json | 2 +- packages/contentstack-import/package.json | 2 +- packages/contentstack-launch/package.json | 2 +- .../contentstack-migrate-rte/package.json | 2 +- packages/contentstack-migration/package.json | 2 +- packages/contentstack-seed/package.json | 2 +- packages/contentstack-utilities/package.json | 2 +- .../src/auth-handler.ts | 3 +- pnpm-lock.yaml | 30 ++++++++--------- 19 files changed, 49 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index cf5efad16a..19f183a859 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23612,7 +23612,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^4.1.9", "chalk": "^4.1.2", @@ -23874,7 +23874,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", @@ -23922,7 +23922,7 @@ "dependencies": { "@contentstack/cli-cm-seed": "~1.7.0", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13" @@ -24006,7 +24006,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/core": "^2.9.3", "async": "^3.2.4", "big-json": "^3.2.0", @@ -24055,7 +24055,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "bluebird": "^3.7.2", "chalk": "^4.1.2", "dotenv": "^16.1.4", @@ -24095,7 +24095,7 @@ "@contentstack/cli-cm-export": "~1.10.5", "@contentstack/cli-cm-import": "~1.13.4", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "async": "^3.2.4", "chalk": "^4.1.0", "child_process": "^1.0.2", @@ -24143,7 +24143,7 @@ "version": "1.2.17", "license": "MIT", "dependencies": { - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "contentstack": "^3.10.1" }, "devDependencies": { @@ -24224,7 +24224,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", @@ -24529,7 +24529,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/core": "^2.9.3", "async": "^3.2.4", "big-json": "^3.2.0", @@ -24579,7 +24579,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "chalk": "^4.1.0", "fast-csv": "^4.3.6", "inquirer": "8.2.4", @@ -24998,7 +24998,7 @@ "dependencies": { "@contentstack/cli-audit": "~1.4.0", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@contentstack/management": "~1.13.0", "@oclif/core": "^2.9.3", "big-json": "^3.2.0", @@ -25128,7 +25128,7 @@ "dependencies": { "@apollo/client": "^3.7.9", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^4.1.9", @@ -25401,7 +25401,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@contentstack/json-rte-serializer": "~2.0.4", "chalk": "^4.1.2", "collapse-whitespace": "^1.1.7", @@ -25440,7 +25440,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "async": "^3.2.4", "callsites": "^3.1.0", "cardinal": "^2.1.1", @@ -25474,7 +25474,7 @@ "dependencies": { "@contentstack/cli-cm-import": "~1.13.4", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13", @@ -25556,7 +25556,7 @@ }, "packages/contentstack-utilities": { "name": "@contentstack/cli-utilities", - "version": "1.5.12", + "version": "1.5.13", "license": "MIT", "dependencies": { "@contentstack/management": "~1.13.0", diff --git a/packages/contentstack-audit/package.json b/packages/contentstack-audit/package.json index a046c729a3..e721409e11 100644 --- a/packages/contentstack-audit/package.json +++ b/packages/contentstack-audit/package.json @@ -19,7 +19,7 @@ ], "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^4.1.9", "chalk": "^4.1.2", diff --git a/packages/contentstack-auth/package.json b/packages/contentstack-auth/package.json index 448f3a0c16..e77221f06e 100644 --- a/packages/contentstack-auth/package.json +++ b/packages/contentstack-auth/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", diff --git a/packages/contentstack-bootstrap/package.json b/packages/contentstack-bootstrap/package.json index a7c52f1f5a..7c751aa077 100644 --- a/packages/contentstack-bootstrap/package.json +++ b/packages/contentstack-bootstrap/package.json @@ -19,7 +19,7 @@ "dependencies": { "@contentstack/cli-cm-seed": "~1.7.0", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13" diff --git a/packages/contentstack-branches/package.json b/packages/contentstack-branches/package.json index 131f3fb134..7ecef1ad77 100644 --- a/packages/contentstack-branches/package.json +++ b/packages/contentstack-branches/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/core": "^2.9.3", "async": "^3.2.4", "big-json": "^3.2.0", diff --git a/packages/contentstack-bulk-publish/package.json b/packages/contentstack-bulk-publish/package.json index 2cfda05977..b1fed62ceb 100644 --- a/packages/contentstack-bulk-publish/package.json +++ b/packages/contentstack-bulk-publish/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "bluebird": "^3.7.2", "chalk": "^4.1.2", "dotenv": "^16.1.4", diff --git a/packages/contentstack-clone/package.json b/packages/contentstack-clone/package.json index 43aa7a03b6..783be690cb 100644 --- a/packages/contentstack-clone/package.json +++ b/packages/contentstack-clone/package.json @@ -8,7 +8,7 @@ "@contentstack/cli-cm-export": "~1.10.5", "@contentstack/cli-cm-import": "~1.13.4", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@colors/colors": "^1.5.0", "async": "^3.2.4", "chalk": "^4.1.0", diff --git a/packages/contentstack-command/package.json b/packages/contentstack-command/package.json index 91cda88e62..4654db6e5b 100644 --- a/packages/contentstack-command/package.json +++ b/packages/contentstack-command/package.json @@ -17,7 +17,7 @@ "format": "eslint src/**/*.ts --fix" }, "dependencies": { - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "contentstack": "^3.10.1" }, "devDependencies": { diff --git a/packages/contentstack-config/package.json b/packages/contentstack-config/package.json index 50b85a6931..e5a775383c 100644 --- a/packages/contentstack-config/package.json +++ b/packages/contentstack-config/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", diff --git a/packages/contentstack-export-to-csv/package.json b/packages/contentstack-export-to-csv/package.json index 86bde2c529..6909033e04 100644 --- a/packages/contentstack-export-to-csv/package.json +++ b/packages/contentstack-export-to-csv/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "chalk": "^4.1.0", "fast-csv": "^4.3.6", "inquirer": "8.2.4", diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index e70f726b5a..26dc1f4053 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/core": "^2.9.3", "async": "^3.2.4", "big-json": "^3.2.0", diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 7c612fd273..65ff8139dc 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -7,7 +7,7 @@ "dependencies": { "@contentstack/cli-audit": "~1.4.0", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@contentstack/management": "~1.13.0", "@oclif/core": "^2.9.3", "big-json": "^3.2.0", diff --git a/packages/contentstack-launch/package.json b/packages/contentstack-launch/package.json index 1704922306..9a14449afb 100755 --- a/packages/contentstack-launch/package.json +++ b/packages/contentstack-launch/package.json @@ -19,7 +19,7 @@ "dependencies": { "@apollo/client": "^3.7.9", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^4.1.9", diff --git a/packages/contentstack-migrate-rte/package.json b/packages/contentstack-migrate-rte/package.json index 43f16ef3f6..36545459be 100644 --- a/packages/contentstack-migrate-rte/package.json +++ b/packages/contentstack-migrate-rte/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "@contentstack/json-rte-serializer": "~2.0.4", "collapse-whitespace": "^1.1.7", "chalk": "^4.1.2", diff --git a/packages/contentstack-migration/package.json b/packages/contentstack-migration/package.json index 3f56e8e0a6..a5b07daa4e 100644 --- a/packages/contentstack-migration/package.json +++ b/packages/contentstack-migration/package.json @@ -5,7 +5,7 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "async": "^3.2.4", "callsites": "^3.1.0", "cardinal": "^2.1.1", diff --git a/packages/contentstack-seed/package.json b/packages/contentstack-seed/package.json index 22a7c5808e..e09b96b882 100644 --- a/packages/contentstack-seed/package.json +++ b/packages/contentstack-seed/package.json @@ -7,7 +7,7 @@ "dependencies": { "@contentstack/cli-cm-import": "~1.13.4", "@contentstack/cli-command": "~1.2.16", - "@contentstack/cli-utilities": "~1.5.12", + "@contentstack/cli-utilities": "~1.5.13", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13", diff --git a/packages/contentstack-utilities/package.json b/packages/contentstack-utilities/package.json index 5b5659b796..3e2d8b6a7f 100644 --- a/packages/contentstack-utilities/package.json +++ b/packages/contentstack-utilities/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/cli-utilities", - "version": "1.5.12", + "version": "1.5.13", "description": "Utilities for contentstack projects", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/contentstack-utilities/src/auth-handler.ts b/packages/contentstack-utilities/src/auth-handler.ts index 6878547c68..b043095d2f 100644 --- a/packages/contentstack-utilities/src/auth-handler.ts +++ b/packages/contentstack-utilities/src/auth-handler.ts @@ -39,7 +39,7 @@ class AuthHandler { } constructor() { - this.codeVerifier = crypto.pseudoRandomBytes(32).toString('hex'); + this.codeVerifier = crypto.randomBytes(32).toString('hex'); this.OAuthAppId = process.env.OAUTH_APP_ID || '6400aa06db64de001a31c8a9'; this.OAuthClientId = process.env.OAUTH_CLIENT_ID || 'Ie0FEfTzlfAHL4xM'; this.OAuthRedirectURL = process.env.OAUTH_APP_REDIRECT_URL || 'http://localhost:8184'; @@ -207,6 +207,7 @@ class AuthHandler { async openOAuthURL(): Promise { return new Promise(async (resolve, reject) => { try { + console.log(this.codeVerifier) const digest = crypto.createHash('sha256').update(this.codeVerifier).digest(); const codeChallenge = digest.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); await this.setOAuthBaseURL(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d2be68a439..9befe2bbf0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -123,7 +123,7 @@ importers: specifiers: '@contentstack/cli-command': ~1.2.16 '@contentstack/cli-dev-dependencies': ^1.2.4 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/plugin-help': ^5 '@oclif/plugin-plugins': ^4.1.9 '@oclif/test': ^2.5.6 @@ -187,7 +187,7 @@ importers: packages/contentstack-auth: specifiers: '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@fancy-test/nock': ^0.1.1 '@oclif/plugin-help': ^5.1.19 '@oclif/test': ^2.5.6 @@ -251,7 +251,7 @@ importers: specifiers: '@contentstack/cli-cm-seed': ~1.7.0 '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/test': ^2.5.6 '@types/inquirer': ^9.0.3 '@types/mkdirp': ^1.0.1 @@ -304,7 +304,7 @@ importers: '@contentstack/cli-command': ~1.2.16 '@contentstack/cli-config': ~1.6.1 '@contentstack/cli-dev-dependencies': ~1.2.4 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/core': ^2.9.3 '@oclif/plugin-help': ^5.1.19 '@oclif/test': ^2.5.6 @@ -380,7 +380,7 @@ importers: packages/contentstack-bulk-publish: specifiers: '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/test': ^2.5.6 bluebird: ^3.7.2 chai: ^4.2.0 @@ -426,7 +426,7 @@ importers: '@contentstack/cli-cm-export': ~1.10.5 '@contentstack/cli-cm-import': ~1.13.4 '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/test': ^2.5.6 async: ^3.2.4 chai: ^4.2.0 @@ -479,7 +479,7 @@ importers: packages/contentstack-command: specifiers: - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/test': ^2.5.6 '@types/chai': ^4.2.18 '@types/mkdirp': ^1.0.1 @@ -521,7 +521,7 @@ importers: packages/contentstack-config: specifiers: '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/test': ^2.5.6 '@types/chai': ^4.2.18 '@types/inquirer': ^9.0.3 @@ -610,7 +610,7 @@ importers: '@contentstack/cli-command': ~1.2.16 '@contentstack/cli-config': ~1.6.1 '@contentstack/cli-dev-dependencies': ~1.2.4 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/core': ^2.9.3 '@oclif/plugin-help': ^5.1.19 '@oclif/test': ^2.5.6 @@ -688,7 +688,7 @@ importers: packages/contentstack-export-to-csv: specifiers: '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/test': ^2.5.6 '@types/chai': ^4.3.6 '@types/mocha': ^10.0.1 @@ -732,7 +732,7 @@ importers: specifiers: '@contentstack/cli-audit': ~1.4.0 '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@contentstack/management': ~1.13.0 '@oclif/core': ^2.9.3 '@oclif/test': ^2.5.6 @@ -821,7 +821,7 @@ importers: specifiers: '@apollo/client': ^3.7.9 '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/core': ^2.9.3 '@oclif/plugin-help': ^5 '@oclif/plugin-plugins': ^4.1.9 @@ -897,7 +897,7 @@ importers: packages/contentstack-migrate-rte: specifiers: '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@contentstack/json-rte-serializer': ~2.0.4 '@oclif/test': ^2.5.6 chai: ^4.3.4 @@ -944,7 +944,7 @@ importers: packages/contentstack-migration: specifiers: '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/test': ^2.5.6 async: ^3.2.4 callsites: ^3.1.0 @@ -992,7 +992,7 @@ importers: specifiers: '@contentstack/cli-cm-import': ~1.13.4 '@contentstack/cli-command': ~1.2.16 - '@contentstack/cli-utilities': ~1.5.12 + '@contentstack/cli-utilities': ~1.5.13 '@oclif/plugin-help': ^5.1.19 '@types/inquirer': ^9.0.3 '@types/jest': ^26.0.15 From 8d0fcd73bec9091d286f4bd101415634706500d1 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Mon, 19 Feb 2024 15:21:30 +0530 Subject: [PATCH 2/2] removed stray console log --- packages/contentstack-utilities/src/auth-handler.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/contentstack-utilities/src/auth-handler.ts b/packages/contentstack-utilities/src/auth-handler.ts index b043095d2f..98dbda88f5 100644 --- a/packages/contentstack-utilities/src/auth-handler.ts +++ b/packages/contentstack-utilities/src/auth-handler.ts @@ -207,7 +207,6 @@ class AuthHandler { async openOAuthURL(): Promise { return new Promise(async (resolve, reject) => { try { - console.log(this.codeVerifier) const digest = crypto.createHash('sha256').update(this.codeVerifier).digest(); const codeChallenge = digest.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); await this.setOAuthBaseURL();