From 415041f3f7976255acacf255a0bff07e7a0be9d4 Mon Sep 17 00:00:00 2001 From: idimov-keeper <78815270+idimov-keeper@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:45:31 -0500 Subject: [PATCH] KSM-544 added search by title (#636) --- .../ksm-azure-devops-secrets-task/index.ts | 75 ++++-- .../package-lock.json | 236 +++++++++++++++--- .../package.json | 10 +- .../tests/_suite.ts | 3 - .../tests/success.ts | 6 +- 5 files changed, 255 insertions(+), 75 deletions(-) diff --git a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/index.ts b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/index.ts index d31fb658..9c0789ea 100644 --- a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/index.ts +++ b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/index.ts @@ -1,7 +1,14 @@ -import * as tl from "azure-pipelines-task-lib/task"; -import {IssueType} from "azure-pipelines-task-lib"; -import {downloadFile, getSecrets, getValue, KeeperFile, loadJsonConfig} from "@keeper-security/secrets-manager-core"; -import * as fs from "fs"; +import * as tl from "azure-pipelines-task-lib/task" +import {IssueType} from "azure-pipelines-task-lib" +import { + downloadFile, + getSecrets, + getValue, + KeeperFile, + loadJsonConfig, + parseNotation +} from "@keeper-security/secrets-manager-core" +import * as fs from "fs" /* Azure Pipeline: @@ -29,6 +36,7 @@ enum DestinationType { type SecretsInput = { notation: string + parsedNotation: any[] destination: string destinationType: DestinationType } @@ -37,11 +45,18 @@ export const parseSecretsInputs = (inputs: string[]): SecretsInput[] => { const results: SecretsInput[] = [] for (const input of inputs) { - const inputParts = input.split('>') + const pos = input.lastIndexOf('>') + if (pos < 0) { + tl.debug("Error parsing input '" + input + "' - Skipped (expected format: notation > destination)") + continue + } + + const inputParts = [input.slice(0, pos), input.slice(pos + 1)] + const parsedNotation = parseNotation(inputParts[0]) const notation = inputParts[0].trim() + let destinationType: DestinationType = DestinationType.output let destination = inputParts[1].trim() - if (destination.startsWith('out:')) { destinationType = DestinationType.output destination = destination.slice(4) @@ -53,12 +68,13 @@ export const parseSecretsInputs = (inputs: string[]): SecretsInput[] => { destination = destination.slice(5) } - if (notation.split('/')[1] === 'file') { + if (parsedNotation[2]?.text && parsedNotation[2].text[0] === 'file') { destinationType = DestinationType.file } results.push({ notation: notation, + parsedNotation: parsedNotation, destination, destinationType }) @@ -74,13 +90,21 @@ export const getRecordUids = (inputs: SecretsInput[]): string[] => { return Array.from(set) } +export const getRecordFilter = (inputs: SecretsInput[]): string[] => { + const rids: Set = new Set(inputs.map(item => item.parsedNotation[1].text[0])); + const records = Array.from(rids) + // if non UID detected (search by title) return empty list + const hasTitles: boolean = records.some(item => ! item.match(/^[A-Za-z0-9_-]{22}$/)) + const uidFilter: string[] = hasTitles ? [] : records + return uidFilter +} + const downloadSecretFile = async (file: KeeperFile, destination: string): Promise => { const fileData = await downloadFile(file) fs.writeFileSync(destination, fileData) } async function run() { - try { const config: string | undefined = tl.getInput('keepersecretconfig', true) const secrets_input_arr = tl.getDelimitedInput('secrets', '\n', true) @@ -92,20 +116,31 @@ async function run() { // @ts-ignore const inputs = parseSecretsInputs(secrets_input_arr) - const uids_to_retrieve = getRecordUids(inputs) - const secrets = await getSecrets({storage: loadJsonConfig(config)}, uids_to_retrieve). + let uids_to_retrieve = getRecordFilter(inputs) + let secrets = await getSecrets({storage: loadJsonConfig(config)}, uids_to_retrieve). catch(reason => { tl.logIssue(IssueType.Error, reason.stack) tl.setResult(tl.TaskResult.Failed, reason.message) return }) + // there's a slight chance a valid title to match a recordUID (22 url-safe base64 chars) + // or a missing record or record not shared to the KSM App - we need to pull all records + if (uids_to_retrieve && (!secrets || secrets.records.length < uids_to_retrieve.length)) { + tl.debug("KSM didn't get expected number of records - requesting all (search by title or missing UID /not shared to the app/)") + uids_to_retrieve = [] + secrets = await getSecrets({storage: loadJsonConfig(config)}, uids_to_retrieve). + catch(reason => { + tl.logIssue(IssueType.Error, reason.stack) + tl.setResult(tl.TaskResult.Failed, reason.message) + return + }) + } tl.debug("secrets_input_arr: [" + JSON.stringify(secrets_input_arr) + "]") tl.debug("inputs: [" + JSON.stringify(inputs) + "]") tl.debug("uids_to_retrieve: [" + JSON.stringify(uids_to_retrieve) + "]") for (const input of inputs) { - // @ts-ignore const secret = await getValue(secrets, input.notation) @@ -131,7 +166,6 @@ async function run() { // name: echovar // // See: https://stackoverflow.com/a/56518088/51230 - break case DestinationType.output: tl.setVariable(input.destination, secret, true, true) @@ -148,27 +182,20 @@ async function run() { // See: https://www.nigelfrank.com/blog/azure-devops-output-variables/ break case DestinationType.file: - await downloadSecretFile(secret as KeeperFile, input.destination) tl.debug(`Finish downloading file to ${input.destination}`) - - // xtlguWgodbpFkKJn7_7mAQ/file/rose2.jpeg > file:/tmp/rose2.jpeg - break } } - } catch (error) { - if (error != null) - { // @ts-ignore - tl.setResult(tl.TaskResult.Failed, error.message); - } + // @ts-ignore + tl.setResult(tl.TaskResult.Failed, error?.message ?? "unknown error") } } run().then((result) => { - tl.setResult(tl.TaskResult.Succeeded, ""); + tl.setResult(tl.TaskResult.Succeeded, "") }) .catch((error) => { - tl.setResult(tl.TaskResult.Failed, error); -}); + tl.setResult(tl.TaskResult.Failed, error) +}) diff --git a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package-lock.json b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package-lock.json index ce159cb5..999ce173 100644 --- a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package-lock.json +++ b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package-lock.json @@ -10,13 +10,50 @@ "license": "MIT", "dependencies": { "@keeper-security/secrets-manager-core": "^16.6.2", - "azure-pipelines-task-lib": "^4.13.0-preview" + "azure-pipelines-task-lib": "^4.15.0" }, "devDependencies": { - "@types/mocha": "^10.0.6", + "@types/mocha": "^10.0.7", "@types/node": "^20.14.2", "@types/q": "^1.5.8", - "nock": "^13.5.4" + "ts-node": "^10.9.2" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" } }, "node_modules/@keeper-security/secrets-manager-core": { @@ -24,10 +61,34 @@ "resolved": "https://registry.npmjs.org/@keeper-security/secrets-manager-core/-/secrets-manager-core-16.6.2.tgz", "integrity": "sha512-aqbZ0c8Q2wJw3B/dunqZf8iYTGnMPwgA3ozthccmMdI/00WlymfcErW+agfAGDr7cJ/9GzqCty0ECee5k9Z+fw==" }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, "node_modules/@types/mocha": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", - "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", + "version": "10.0.7", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.7.tgz", + "integrity": "sha512-GN8yJ1mNTcFcah/wKEFIJckJx9iJLoMSzWcfRRuxz/Jk+U6KQNnml+etbtxFK8lPjzOw3zp4Ha/kjSst9fsHYw==", "dev": true }, "node_modules/@types/node": { @@ -45,6 +106,30 @@ "integrity": "sha512-hroOstUScF6zhIi+5+x0dzqrHA1EJi+Irri6b1fxolMTqqHIV/Cg77EtnQcZqZCu8hR3mX2BzIxN4/GzI68Kfw==", "dev": true }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/adm-zip": { "version": "0.5.14", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.14.tgz", @@ -64,10 +149,16 @@ "node": ">= 6.0.0" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "node_modules/azure-pipelines-task-lib": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.13.0.tgz", - "integrity": "sha512-KVguui31If98vgokNepHUxE3/D8UFB4FHV1U6XxjGOkgxxwKxbupC3knVnEiZA/hNl7X+vmj9KrYOx79iwmezQ==", + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.15.0.tgz", + "integrity": "sha512-Y72FjLTE2CAM9KrBXzc6vjelTBCpdYb2NkyFB0hwksTrhA3q8nsF680dofuTeXztQ94UTpkK27hpgSHnqYf5ZA==", "dependencies": { "adm-zip": "^0.5.10", "minimatch": "3.0.5", @@ -97,6 +188,12 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -113,6 +210,15 @@ } } }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/follow-redirects": { "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", @@ -138,9 +244,12 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/glob": { "version": "7.2.3", @@ -228,10 +337,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, "node_modules/mime-db": { @@ -269,20 +378,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/nock": { - "version": "13.5.4", - "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.4.tgz", - "integrity": "sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==", - "dev": true, - "dependencies": { - "debug": "^4.1.0", - "json-stringify-safe": "^5.0.1", - "propagate": "^2.0.0" - }, - "engines": { - "node": ">= 10.13" - } - }, "node_modules/nodejs-file-downloader": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.13.0.tgz", @@ -315,15 +410,6 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, - "node_modules/propagate": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz", - "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -411,6 +497,63 @@ "utf8-byte-length": "^1.0.1" } }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -431,10 +574,25 @@ "uuid": "bin/uuid" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } } } } diff --git a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package.json b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package.json index 404b655c..d35017cd 100644 --- a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package.json +++ b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/package.json @@ -5,20 +5,20 @@ "main": "index.js", "scripts": { "build": "tsc index.ts", - "run": "tsc && node index.js", + "run": "tsc index.ts && node index.js", "test": "tsc tests/_suite.ts && mocha tests/_suite.js", - "quicktest": "tsc && ts-node index.ts" + "quicktest": "ts-node index.ts" }, "author": "", "license": "MIT", "dependencies": { "@keeper-security/secrets-manager-core": "^16.6.2", - "azure-pipelines-task-lib": "^4.13.0-preview" + "azure-pipelines-task-lib": "^4.15.0" }, "devDependencies": { - "@types/mocha": "^10.0.6", + "@types/mocha": "^10.0.7", "@types/node": "^20.14.2", "@types/q": "^1.5.8", - "nock": "^13.5.4" + "ts-node": "^10.9.2" } } diff --git a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/_suite.ts b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/_suite.ts index 7832cf27..877304a5 100644 --- a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/_suite.ts +++ b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/_suite.ts @@ -1,11 +1,8 @@ import * as path from 'path'; import * as assert from 'assert'; import * as ttm from 'azure-pipelines-task-lib/mock-test'; -//import nock from 'nock'; - describe('Sample task tests', function () { - before( function() { }); diff --git a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/success.ts b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/success.ts index 1afa7dc1..9d720c20 100644 --- a/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/success.ts +++ b/integration/keeper_secrets_manager_azure_pipeline_extension/ksm-azure-devops-secrets-task/tests/success.ts @@ -1,6 +1,5 @@ -import ma = require('azure-pipelines-task-lib/mock-answer'); -import tmrm = require('azure-pipelines-task-lib/mock-run'); -import path = require('path'); +import * as tmrm from "azure-pipelines-task-lib/mock-run" +import * as path from "path" let taskPath = path.join(__dirname, '..', 'index.js'); let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); @@ -15,5 +14,4 @@ tmr.setInput('secrets', 'xtlguWgodbpFkKJn7_7mAQ/field/password > var:MYPWD123\n' 'xtlguWgodbpFkKJn7_7mAQ/field/password > outpwd2\n' + '6ya_fdc6XTsZ7i7x9Jcodg/file/build-vsix.sh > file:/tmp/build-vsix.sh'); // pwd should be `Flor15TPa$$w0rd` - tmr.run();