Socket
Socket
Sign inDemoInstall

azure-pipelines-tasks-artifacts-common

Package Overview
Dependencies
Maintainers
6
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-pipelines-tasks-artifacts-common - npm Package Compare versions

Comparing version 2.219.1 to 2.225.0

azCliUtils.d.ts

8

module.json
{
"messages": {
"AuthSchemeNotSupported": "Auth Scheme %s is not supported",
"CouldNotFetchAccessTokenforAAD": "Could not fetch access token for AAD.",
"CredProvider_AlreadyInstalled": "The credential provider is already installed. If there are package related authentication failures in later steps, consider setting this task's input 'forceReinstallCredentialProvider' to true to force reinstallation.",

@@ -13,5 +15,9 @@ "CredProvider_Error_FailedCopy": "Failed to copy from '%s' to '%s' while installing the credential provider. Ensure that the destination directory is not in use and that the agent account has permission to write to it.",

"CredProvider_SettingUpForServiceConnections": "Setting up the credential provider for these service connections:",
"ErrorInSettingUpSubscription": "Error in setting up subscription",
"LoginFailed": "Azure login failed",
"MSILoginFailed": "Azure login failed using Managed Service Identity",
"ServiceConnections_Error_FailedToParseServiceEndpoint_MissingParameter": "Failed to parse the service endpoint '%s' because it was missing the parameter '%s'",
"ServiceConnections_Error_FailedToParseServiceEndpoint_BadScheme": "Failed to parse the service endpoint '%s' because the auth scheme '%s' was invalid"
"ServiceConnections_Error_FailedToParseServiceEndpoint_BadScheme": "Failed to parse the service endpoint '%s' because the auth scheme '%s' was invalid",
"SettingAzureCloud": "Setting active cloud to: %s"
}
}

4

package.json
{
"name": "azure-pipelines-tasks-artifacts-common",
"version": "2.219.1",
"version": "2.225.0",
"description": "Azure Artifacts common code (for new authentication tasks)",

@@ -18,3 +18,3 @@ "scripts": {

"@types/node": "^16.11.39",
"azure-devops-node-api": "10.2.2",
"azure-devops-node-api": "12.0.0",
"azure-pipelines-task-lib": "^4.2.0",

@@ -21,0 +21,0 @@ "fs-extra": "8.1.0",

@@ -5,1 +5,2 @@ import * as api from 'azure-devops-node-api';

export declare function getSystemAccessToken(): string;
export declare function getFederatedToken(connectedServiceName: string): Promise<string>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSystemAccessToken = exports.getWebApiWithProxy = void 0;
exports.getFederatedToken = exports.getSystemAccessToken = exports.getWebApiWithProxy = void 0;
const Q = require("q");
const path = require("path");
const api = require("azure-devops-node-api");
const azure_devops_node_api_1 = require("azure-devops-node-api");
const tl = require("azure-pipelines-task-lib/task");
tl.setResourcePath(path.join(__dirname, 'module.json'), true);
function getWebApiWithProxy(serviceUri, accessToken, options = {}) {

@@ -28,1 +41,45 @@ const credentialHandler = api.getBasicHandler('vsts', accessToken);

exports.getSystemAccessToken = getSystemAccessToken;
function getFederatedToken(connectedServiceName) {
return __awaiter(this, void 0, void 0, function* () {
const projectId = tl.getVariable("System.TeamProjectId");
const hub = tl.getVariable("System.HostType");
const planId = tl.getVariable('System.PlanId');
const jobId = tl.getVariable('System.JobId');
let uri = tl.getVariable("System.CollectionUri");
if (!uri) {
uri = tl.getVariable("System.TeamFoundationServerUri");
}
const token = getSystemAccessToken();
const authHandler = azure_devops_node_api_1.getHandlerFromToken(token);
const connection = new azure_devops_node_api_1.WebApi(uri, authHandler);
const oidc_token = yield initOIDCToken(connection, projectId, hub, planId, jobId, connectedServiceName, 0, 2000);
return oidc_token;
});
}
exports.getFederatedToken = getFederatedToken;
function initOIDCToken(connection, projectId, hub, planId, jobId, serviceConnectionId, retryCount, timeToWait) {
var deferred = Q.defer();
connection.getTaskApi().then((taskApi) => {
taskApi.createOidcToken({}, projectId, hub, planId, jobId, serviceConnectionId).then((response) => {
if (response != null) {
tl.debug('Got OIDC token');
deferred.resolve(response.oidcToken);
}
else if (response.oidcToken == null) {
if (retryCount < 3) {
let waitedTime = timeToWait;
retryCount += 1;
setTimeout(() => {
deferred.resolve(initOIDCToken(connection, projectId, hub, planId, jobId, serviceConnectionId, retryCount, waitedTime));
}, waitedTime);
}
else {
deferred.reject(tl.loc('CouldNotFetchAccessTokenforAAD'));
}
}
}, (error) => {
deferred.reject(tl.loc('CouldNotFetchAccessTokenforAAD') + " " + error);
});
});
return deferred.promise;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc