Socket
Socket
Sign inDemoInstall

botframework-connector

Package Overview
Dependencies
Maintainers
3
Versions
544
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botframework-connector - npm Package Compare versions

Comparing version 4.23.0-dev.20240405 to 4.23.0-rc1

6

_ts3.4/lib/auth/appCredentials.d.ts

@@ -28,3 +28,7 @@ /**

* @param appId The App ID.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope The scope for the token.

@@ -31,0 +35,0 @@ */

@@ -145,2 +145,6 @@ /**

/**
* Tenant ID claim name. As used in Microsoft AAD tokens.
*/
const TenantIdClaim = "tid";
/**
* AppId used for creating skill claims when there is no appId and password configured.

@@ -147,0 +151,0 @@ */

10

_ts3.4/lib/auth/botFrameworkClientImpl.d.ts
import { Activity, InvokeResponse } from 'botframework-schema';
import { BotFrameworkClient } from '../skills';
import { ConnectorClientOptions } from '../connectorApi/models';
import { ServiceClientCredentialsFactory } from './serviceClientCredentialsFactory';
declare const botFrameworkClientFetchImpl: (connectorClientOptions: ConnectorClientOptions) => typeof fetch;
/**

@@ -11,3 +13,4 @@ * @internal

private readonly loginEndpoint;
private readonly botFrameworkClientFetch;
private readonly botFrameworkClientFetch?;
private readonly connectorClientOptions?;
/**

@@ -17,4 +20,6 @@ * @param credentialsFactory A [ServiceClientCredentialsFactory](xref:botframework-connector.ServiceClientCredentialsFactory) instance.

* @param botFrameworkClientFetch A custom Fetch implementation to be used in the [BotFrameworkClient](xref:botframework-connector.BotFrameworkClient).
* @param connectorClientOptions A [ConnectorClientOptions](xref:botframework-connector.ConnectorClientOptions) object.
*/
constructor(credentialsFactory: ServiceClientCredentialsFactory, loginEndpoint: string, botFrameworkClientFetch?: typeof globalThis.fetch);
constructor(credentialsFactory: ServiceClientCredentialsFactory, loginEndpoint: string, botFrameworkClientFetch?: ReturnType<typeof botFrameworkClientFetchImpl>, connectorClientOptions?: ConnectorClientOptions);
private toJSON;
/**

@@ -32,2 +37,3 @@ * @template T The type of body in the InvokeResponse.

}
export {};
//# sourceMappingURL=botFrameworkClientImpl.d.ts.map

@@ -24,3 +24,7 @@ /**

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope Optional. The scope for the token.

@@ -27,0 +31,0 @@ * @param x5c Optional. Enables application developers to achieve easy certificates roll-over in Azure AD:

@@ -25,3 +25,7 @@ /**

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param tenantId Optional. The oauth token tenant.
* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param x5c Optional. Enables application developers to achieve easy certificates roll-over in Azure AD:

@@ -38,3 +42,7 @@ * set this parameter to send the public certificate (BEGIN CERTIFICATE) to Azure AD, so that Azure AD can use it to validate the subject name based on a trusted issuer policy.

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param tenantId Optional. The oauth token tenant.
* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
*/

@@ -41,0 +49,0 @@ constructor(appId: string, x5c: string, certificatePrivateKey: string, tenantId?: string);

@@ -25,3 +25,7 @@ /**

* @param {string} appPassword The Microsoft app password.
* @param {string} channelAuthTenant Optional. The oauth token tenant.
* @param {string} channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param {string} oAuthScope Optional. The scope for the token.

@@ -28,0 +32,0 @@ */

@@ -36,2 +36,6 @@ /**

* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
*/

@@ -38,0 +42,0 @@ constructor(appId: string, password: string, tenantId: string);

@@ -8,2 +8,4 @@ /// <reference types="node" />

import { AttachmentInfo, ChannelAccount, ConversationResourceResponse, ConversationsResult, PagedMembersResult, ResourceResponse } from "botframework-schema";
import { Agent as HttpAgent } from "http";
import { Agent as HttpsAgent } from "https";
export * from "botframework-schema";

@@ -19,4 +21,15 @@ /**

baseUri?: string;
/**
* HTTP and HTTPS agents which will be used for every HTTP request (Node.js only).
*/
agentSettings?: AgentSettings;
}
/**
* HTTP and HTTPS agents (Node.js only)
*/
export interface AgentSettings {
http: HttpAgent;
https: HttpsAgent;
}
/**
* Optional Parameters.

@@ -23,0 +36,0 @@ */

@@ -28,3 +28,7 @@ /**

* @param appId The App ID.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope The scope for the token.

@@ -31,0 +35,0 @@ */

@@ -41,3 +41,7 @@ "use strict";

* @param appId The App ID.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope The scope for the token.

@@ -44,0 +48,0 @@ */

@@ -145,2 +145,6 @@ /**

/**
* Tenant ID claim name. As used in Microsoft AAD tokens.
*/
const TenantIdClaim = "tid";
/**
* AppId used for creating skill claims when there is no appId and password configured.

@@ -147,0 +151,0 @@ */

@@ -150,2 +150,6 @@ "use strict";

/**
* Tenant ID claim name. As used in Microsoft AAD tokens.
*/
AuthenticationConstants.TenantIdClaim = 'tid';
/**
* AppId used for creating skill claims when there is no appId and password configured.

@@ -152,0 +156,0 @@ */

import { Activity, InvokeResponse } from 'botframework-schema';
import { BotFrameworkClient } from '../skills';
import type { ConnectorClientOptions } from '../connectorApi/models';
import { ServiceClientCredentialsFactory } from './serviceClientCredentialsFactory';
declare const botFrameworkClientFetchImpl: (connectorClientOptions: ConnectorClientOptions) => typeof fetch;
/**

@@ -11,3 +13,4 @@ * @internal

private readonly loginEndpoint;
private readonly botFrameworkClientFetch;
private readonly botFrameworkClientFetch?;
private readonly connectorClientOptions?;
/**

@@ -17,4 +20,6 @@ * @param credentialsFactory A [ServiceClientCredentialsFactory](xref:botframework-connector.ServiceClientCredentialsFactory) instance.

* @param botFrameworkClientFetch A custom Fetch implementation to be used in the [BotFrameworkClient](xref:botframework-connector.BotFrameworkClient).
* @param connectorClientOptions A [ConnectorClientOptions](xref:botframework-connector.ConnectorClientOptions) object.
*/
constructor(credentialsFactory: ServiceClientCredentialsFactory, loginEndpoint: string, botFrameworkClientFetch?: typeof globalThis.fetch);
constructor(credentialsFactory: ServiceClientCredentialsFactory, loginEndpoint: string, botFrameworkClientFetch?: ReturnType<typeof botFrameworkClientFetchImpl>, connectorClientOptions?: ConnectorClientOptions);
private toJSON;
/**

@@ -32,2 +37,3 @@ * @template T The type of body in the InvokeResponse.

}
export {};
//# sourceMappingURL=botFrameworkClientImpl.d.ts.map
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -13,5 +36,19 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BotFrameworkClientImpl = void 0;
const z = require("zod");
const z = __importStar(require("zod"));
const botframework_schema_1 = require("botframework-schema");

@@ -22,16 +59,26 @@ const conversationConstants_1 = require("../conversationConstants");

const assert_1 = require("assert");
const cross_fetch_1 = require("cross-fetch");
const botFrameworkClientFetchImpl = (input, init) => __awaiter(void 0, void 0, void 0, function* () {
const url = z.string().parse(input);
const { body, headers } = z.object({ body: z.string(), headers: z.record(z.string()).optional() }).parse(init);
const response = yield (0, cross_fetch_1.default)(url, {
method: 'POST',
body,
headers,
const axios_1 = __importDefault(require("axios"));
const botFrameworkClientFetchImpl = (connectorClientOptions) => {
var _a;
const { http: httpAgent, https: httpsAgent } = (_a = connectorClientOptions === null || connectorClientOptions === void 0 ? void 0 : connectorClientOptions.agentSettings) !== null && _a !== void 0 ? _a : {
http: undefined,
https: undefined,
};
const axiosInstance = axios_1.default.create({
httpAgent,
httpsAgent,
validateStatus: () => true,
});
return {
status: response.status,
json: () => __awaiter(void 0, void 0, void 0, function* () { return response.body; }),
};
});
return (input, init) => __awaiter(void 0, void 0, void 0, function* () {
const url = z.string().parse(input);
const { body, headers } = z.object({ body: z.string(), headers: z.record(z.string()).optional() }).parse(init);
const response = yield axiosInstance.post(url, body, {
headers,
});
return {
status: response.status,
json: () => response.data,
};
});
};
/**

@@ -46,9 +93,19 @@ * @internal

* @param botFrameworkClientFetch A custom Fetch implementation to be used in the [BotFrameworkClient](xref:botframework-connector.BotFrameworkClient).
* @param connectorClientOptions A [ConnectorClientOptions](xref:botframework-connector.ConnectorClientOptions) object.
*/
constructor(credentialsFactory, loginEndpoint, botFrameworkClientFetch = botFrameworkClientFetchImpl) {
constructor(credentialsFactory, loginEndpoint, botFrameworkClientFetch, connectorClientOptions) {
var _a;
this.credentialsFactory = credentialsFactory;
this.loginEndpoint = loginEndpoint;
this.botFrameworkClientFetch = botFrameworkClientFetch;
(0, assert_1.ok)(typeof botFrameworkClientFetch === 'function');
this.connectorClientOptions = connectorClientOptions;
(_a = this.botFrameworkClientFetch) !== null && _a !== void 0 ? _a : (this.botFrameworkClientFetch = botFrameworkClientFetchImpl(this.connectorClientOptions));
(0, assert_1.ok)(typeof this.botFrameworkClientFetch === 'function');
}
toJSON() {
// Ignore ConnectorClientOptions, as it could contain Circular Structure behavior.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _a = this, { connectorClientOptions } = _a, rest = __rest(_a, ["connectorClientOptions"]);
return rest;
}
/**

@@ -55,0 +112,0 @@ * @template T The type of body in the InvokeResponse.

@@ -24,3 +24,7 @@ /**

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope Optional. The scope for the token.

@@ -27,0 +31,0 @@ * @param x5c Optional. Enables application developers to achieve easy certificates roll-over in Azure AD:

@@ -33,3 +33,7 @@ "use strict";

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope Optional. The scope for the token.

@@ -36,0 +40,0 @@ * @param x5c Optional. Enables application developers to achieve easy certificates roll-over in Azure AD:

@@ -25,3 +25,7 @@ /**

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param tenantId Optional. The oauth token tenant.
* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param x5c Optional. Enables application developers to achieve easy certificates roll-over in Azure AD:

@@ -38,3 +42,7 @@ * set this parameter to send the public certificate (BEGIN CERTIFICATE) to Azure AD, so that Azure AD can use it to validate the subject name based on a trusted issuer policy.

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param tenantId Optional. The oauth token tenant.
* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
*/

@@ -41,0 +49,0 @@ constructor(appId: string, x5c: string, certificatePrivateKey: string, tenantId?: string);

@@ -9,2 +9,25 @@ "use strict";

*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -25,3 +48,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

const util_1 = require("util");
const opensslWrapper = require("openssl-wrapper");
const opensslWrapper = __importStar(require("openssl-wrapper"));
const openssl = (0, util_1.promisify)(opensslWrapper.default);

@@ -28,0 +51,0 @@ /**

@@ -47,2 +47,3 @@ "use strict";

function isTokenFromEmulator(authHeader) {
var _a;
// The Auth Header generally looks like this:

@@ -75,3 +76,3 @@ // "Bearer eyJ0e[...Big Long String...]XAiO"

// Is there an Issuer?
const issuer = token.payload.iss;
const issuer = token.payload[authenticationConstants_1.AuthenticationConstants.IssuerClaim];
if (!issuer) {

@@ -81,2 +82,15 @@ // No Issuer, means it's not from the Emulator.

}
//Validation to manage the issuer object as a string.
if (Array.isArray(tokenValidationParameters_1.ToBotFromBotOrEmulatorTokenValidationParameters.issuer)) {
const tenantId = (_a = token === null || token === void 0 ? void 0 : token.payload[authenticationConstants_1.AuthenticationConstants.TenantIdClaim]) !== null && _a !== void 0 ? _a : '';
//Validate if there is an existing issuer with the same tid value.
if (tenantId != '' &&
tokenValidationParameters_1.ToBotFromBotOrEmulatorTokenValidationParameters.issuer.find((issuer) => issuer.includes(tenantId)) ==
null) {
//If the issuer doesn't exist, this is added using the Emulator token issuer structure.
//This allows use of the SingleTenant authentication through Emulator.
const newIssuer = authenticationConstants_1.AuthenticationConstants.ValidTokenIssuerUrlTemplateV1 + `${tenantId}/`;
tokenValidationParameters_1.ToBotFromBotOrEmulatorTokenValidationParameters.issuer.push(newIssuer);
}
}
// Is the token issues by a source we consider to be the emulator?

@@ -83,0 +97,0 @@ if (EmulatorValidation.ToBotFromEmulatorTokenValidationParameters.issuer &&

@@ -53,3 +53,4 @@ "use strict";

}
if (!authHeader.trim()) {
// eslint-disable-next-line prettier/prettier
if (!authHeader.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty header as part of that.
const isAuthDisabled = yield credentials.isAuthenticationDisabled();

@@ -110,3 +111,4 @@ if (!isAuthDisabled) {

if (isPublicAzure(channelService)) {
if (serviceUrl.trim()) {
// eslint-disable-next-line prettier/prettier
if (serviceUrl.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty serviceUrl as part of that.
return yield channelValidation_1.ChannelValidation.authenticateChannelTokenWithServiceUrl(authHeader, credentials, serviceUrl, channelId);

@@ -117,3 +119,4 @@ }

if (isGovernment(channelService)) {
if (serviceUrl.trim()) {
// eslint-disable-next-line prettier/prettier
if (serviceUrl.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty serviceUrl as part of that.
return yield governmentChannelValidation_1.GovernmentChannelValidation.authenticateChannelTokenWithServiceUrl(authHeader, credentials, serviceUrl, channelId);

@@ -124,3 +127,4 @@ }

// Otherwise use Enterprise Channel Validation
if (serviceUrl.trim()) {
// eslint-disable-next-line prettier/prettier
if (serviceUrl.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty serviceUrl as part of that.
return yield enterpriseChannelValidation_1.EnterpriseChannelValidation.authenticateChannelTokenWithServiceUrl(authHeader, credentials, serviceUrl, channelId, channelService);

@@ -127,0 +131,0 @@ }

@@ -25,3 +25,7 @@ /**

* @param {string} appPassword The Microsoft app password.
* @param {string} channelAuthTenant Optional. The oauth token tenant.
* @param {string} channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param {string} oAuthScope Optional. The scope for the token.

@@ -28,0 +32,0 @@ */

@@ -31,3 +31,7 @@ "use strict";

* @param {string} appPassword The Microsoft app password.
* @param {string} channelAuthTenant Optional. The oauth token tenant.
* @param {string} channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param {string} oAuthScope Optional. The scope for the token.

@@ -34,0 +38,0 @@ */

@@ -47,5 +47,3 @@ "use strict";

auth.clientSecret =
typeof maybeAppIdOrAppPasswordOrCertificate === 'string'
? maybeAppIdOrAppPasswordOrCertificate
: undefined;
typeof maybeAppIdOrAppPasswordOrCertificate === 'string' ? maybeAppIdOrAppPasswordOrCertificate : '';
this.clientApplication = new msal_node_1.ConfidentialClientApplication({ auth });

@@ -52,0 +50,0 @@ }

@@ -18,7 +18,10 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenIdMetadata = void 0;
const getPem = require("rsa-pem-from-mod-exp");
const base64url_1 = require("base64url");
const node_fetch_1 = require("node-fetch");
const rsa_pem_from_mod_exp_1 = __importDefault(require("rsa-pem-from-mod-exp"));
const base64url_1 = __importDefault(require("base64url"));
const node_fetch_1 = __importDefault(require("node-fetch"));
const https_proxy_agent_1 = require("https-proxy-agent");

@@ -112,3 +115,3 @@ const authenticationError_1 = require("./authenticationError");

return {
key: getPem(modulus, exponent),
key: (0, rsa_pem_from_mod_exp_1.default)(modulus, exponent),
endorsements: key.endorsements,

@@ -115,0 +118,0 @@ };

@@ -168,3 +168,3 @@ "use strict";

createBotFrameworkClient() {
return new botFrameworkClientImpl_1.BotFrameworkClientImpl(this.credentialsFactory, this.toChannelFromBotLoginUrl, this.botFrameworkClientFetch);
return new botFrameworkClientImpl_1.BotFrameworkClientImpl(this.credentialsFactory, this.toChannelFromBotLoginUrl, this.botFrameworkClientFetch, this.connectorClientOptions);
}

@@ -171,0 +171,0 @@ JwtTokenValidation_authenticateRequest(activity, authHeader) {

@@ -36,2 +36,6 @@ /**

* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
*/

@@ -38,0 +42,0 @@ constructor(appId: string, password: string, tenantId: string);

"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserTokenClient = void 0;
const z = require("zod");
const z = __importStar(require("zod"));
const botframework_schema_1 = require("botframework-schema");

@@ -8,0 +31,0 @@ /**

"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -15,3 +38,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

exports.UserTokenClientImpl = void 0;
const z = require("zod");
const z = __importStar(require("zod"));
const tokenApiClient_1 = require("../tokenApi/tokenApiClient");

@@ -18,0 +41,0 @@ const userTokenClient_1 = require("./userTokenClient");

@@ -17,2 +17,14 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {

@@ -23,7 +35,7 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);

exports.ConnectorMappers = exports.ConnectorModels = exports.ConnectorClientContext = exports.ConnectorClient = void 0;
const Mappers = require("./models/mappers");
const Mappers = __importStar(require("./models/mappers"));
exports.ConnectorMappers = Mappers;
const Models = require("./models");
const Models = __importStar(require("./models"));
exports.ConnectorModels = Models;
const operations = require("./operations");
const operations = __importStar(require("./operations"));
const connectorClientContext_1 = require("./connectorClientContext");

@@ -30,0 +42,0 @@ Object.defineProperty(exports, "ConnectorClientContext", { enumerable: true, get: function () { return connectorClientContext_1.ConnectorClientContext; } });

@@ -6,4 +6,8 @@ /**

/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import { ServiceClientOptions, RequestOptionsBase, HttpResponse } from "@azure/core-http";
import { AttachmentInfo, ChannelAccount, ConversationResourceResponse, ConversationsResult, PagedMembersResult, ResourceResponse } from "botframework-schema";
import type { Agent as HttpAgent } from "http";
import type { Agent as HttpsAgent } from "https";
export * from "botframework-schema";

@@ -19,4 +23,15 @@ /**

baseUri?: string;
/**
* HTTP and HTTPS agents which will be used for every HTTP request (Node.js only).
*/
agentSettings?: AgentSettings;
}
/**
* HTTP and HTTPS agents (Node.js only)
*/
export interface AgentSettings {
http: HttpAgent;
https: HttpsAgent;
}
/**
* Optional Parameters.

@@ -23,0 +38,0 @@ */

@@ -6,7 +6,30 @@ "use strict";

*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Attachments = void 0;
const core_http_1 = require("@azure/core-http");
const Mappers = require("../models/attachmentsMappers");
const Parameters = require("../models/parameters");
const Mappers = __importStar(require("../models/attachmentsMappers"));
const Parameters = __importStar(require("../models/parameters"));
/** Class representing a Attachments. */

@@ -13,0 +36,0 @@ class Attachments {

@@ -6,6 +6,29 @@ "use strict";

*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Conversations = void 0;
const Mappers = require("../models/conversationsMappers");
const Parameters = require("../models/parameters");
const Mappers = __importStar(require("../models/conversationsMappers"));
const Parameters = __importStar(require("../models/parameters"));
const core_http_1 = require("@azure/core-http");

@@ -12,0 +35,0 @@ const conversationConstants_1 = require("../../conversationConstants");

@@ -18,5 +18,8 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmulatorApiClient = void 0;
const cross_fetch_1 = require("cross-fetch");
const cross_fetch_1 = __importDefault(require("cross-fetch"));
/**

@@ -23,0 +26,0 @@ * The purpose of this class is to emulate an api client.

@@ -20,5 +20,17 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -36,3 +48,3 @@ exports.ConversationConstants = exports.TokenApiModels = exports.TokenApiClient = exports.EmulatorApiClient = exports.ConnectorClient = void 0;

Object.defineProperty(exports, "TokenApiModels", { enumerable: true, get: function () { return tokenApiClient_1.TokenApiModels; } });
exports.ConversationConstants = require("./conversationConstants");
exports.ConversationConstants = __importStar(require("./conversationConstants"));
//# sourceMappingURL=index.js.map

@@ -7,7 +7,30 @@ "use strict";

*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Teams = void 0;
const core_http_1 = require("@azure/core-http");
const Mappers = require("../models/teamsMappers");
const Parameters = require("../models/parameters");
const Mappers = __importStar(require("../models/teamsMappers"));
const Parameters = __importStar(require("../models/parameters"));
const __1 = require("../");

@@ -14,0 +37,0 @@ /** Class representing a Teams. */

@@ -17,2 +17,14 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {

@@ -23,7 +35,7 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);

exports.TeamsConnectorMappers = exports.TeamsConnectorModels = exports.TeamsConnectorClientContext = exports.TeamsConnectorClient = void 0;
const Models = require("./models");
const Models = __importStar(require("./models"));
exports.TeamsConnectorModels = Models;
const Mappers = require("./models/mappers");
const Mappers = __importStar(require("./models/mappers"));
exports.TeamsConnectorMappers = Mappers;
const operations = require("./operations");
const operations = __importStar(require("./operations"));
const teamsConnectorClientContext_1 = require("./teamsConnectorClientContext");

@@ -30,0 +42,0 @@ Object.defineProperty(exports, "TeamsConnectorClientContext", { enumerable: true, get: function () { return teamsConnectorClientContext_1.TeamsConnectorClientContext; } });

@@ -6,7 +6,30 @@ "use strict";

*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BotSignIn = void 0;
const core_http_1 = require("@azure/core-http");
const Mappers = require("../models/botSignInMappers");
const Parameters = require("../models/parameters");
const Mappers = __importStar(require("../models/botSignInMappers"));
const Parameters = __importStar(require("../models/parameters"));
/** Class representing a BotSignIn. */

@@ -13,0 +36,0 @@ class BotSignIn {

@@ -6,7 +6,30 @@ "use strict";

*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserToken = void 0;
const core_http_1 = require("@azure/core-http");
const Mappers = require("../models/userTokenMappers");
const Parameters = require("../models/parameters");
const Mappers = __importStar(require("../models/userTokenMappers"));
const Parameters = __importStar(require("../models/parameters"));
/** Class representing a UserToken. */

@@ -13,0 +36,0 @@ class UserToken {

@@ -17,2 +17,14 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {

@@ -23,7 +35,7 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);

exports.TokenApiMappers = exports.TokenApiModels = exports.TokenApiClientContext = exports.TokenApiClient = void 0;
const Models = require("./models");
const Models = __importStar(require("./models"));
exports.TokenApiModels = Models;
const Mappers = require("./models/mappers");
const Mappers = __importStar(require("./models/mappers"));
exports.TokenApiMappers = Mappers;
const operations = require("./operations");
const operations = __importStar(require("./operations"));
const tokenApiClientContext_1 = require("./tokenApiClientContext");

@@ -30,0 +42,0 @@ Object.defineProperty(exports, "TokenApiClientContext", { enumerable: true, get: function () { return tokenApiClientContext_1.TokenApiClientContext; } });

@@ -5,3 +5,3 @@ {

"description": "Bot Connector is autorest generated connector client.",
"version": "4.23.0-dev.20240405",
"version": "4.23.0-rc1",
"license": "MIT",

@@ -32,34 +32,42 @@ "keywords": [

"@azure/core-http": "^3.0.2",
"@azure/identity": "^2.0.4",
"@azure/msal-node": "^1.18.4",
"@azure/identity": "^4.4.1",
"@azure/msal-node": "^2.13.0",
"@types/jsonwebtoken": "8.3.5",
"axios": "^1.7.4",
"base64url": "^3.0.0",
"botbuilder-stdlib": "4.23.0-dev.internal.20240405",
"botframework-schema": "4.23.0-dev.20240405",
"botbuilder-stdlib": "4.23.0-rc1.internal",
"botframework-schema": "4.23.0-rc1",
"browserify-fs": "^1.0.0",
"buffer": "^6.0.3",
"cross-fetch": "^3.0.5",
"crypto-browserify": "^3.12.0",
"https-browserify": "^1.0.0",
"https-proxy-agent": "^7.0.2",
"jsonwebtoken": "^9.0.0",
"jsonwebtoken": "^9.0.2",
"node-fetch": "^2.6.7",
"openssl-wrapper": "^0.3.4",
"rsa-pem-from-mod-exp": "^0.8.4",
"zod": "^3.22.4",
"openssl-wrapper": "^0.3.4"
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/jsonwebtoken": "8.3.5",
"@types/node": "^10.17.27",
"botbuilder-test-utils": "0.0.0-dev.20240405",
"botbuilder-test-utils": "0.0.0-rc1",
"dotenv": "^6.2.0",
"esbuild-plugin-polyfill-node": "^0.3.0",
"nock": "^11.9.1",
"should": "^13.2.3"
"should": "^13.2.3",
"tsup": "^8.2.4"
},
"scripts": {
"build": "tsc -b",
"build:browserify": "npm-run-all build:browserify:clean build:browserify:init build:browserify:run",
"build:browserify:clean": "rimraf lib/browser.*",
"build:browserify:init": "shx cp lib/index.js lib/browser.js",
"build:browserify:run": "browserify -s BFC --debug lib/browser.js | exorcist lib/browser.js.map | sponge lib/browser.js",
"build:tsup": "npm-run-all build:tsup:clean build:tsup:run",
"build:tsup:clean": "rimraf lib/browser.*",
"build:tsup:run": "tsup",
"build:downlevel-dts": "downlevel-dts lib _ts3.4/lib --checksum",
"clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo",
"depcheck": "depcheck --config ../../.depcheckrc --ignores azure,sinon",
"depcheck": "depcheck --config ../../.depcheckrc --ignores azure,sinon,browserify-fs,buffer,crypto-browserify,https-browserify,stream-browserify,stream-http",
"lint": "eslint . --ext .js,.ts",
"postbuild": "npm-run-all -p build:browserify build:downlevel-dts",
"postbuild": "npm-run-all -p build:tsup build:downlevel-dts",
"test": "yarn build && yarn test:mocha",

@@ -66,0 +74,0 @@ "test:mocha": "nyc mocha tests --recursive"

@@ -45,3 +45,7 @@ /**

* @param appId The App ID.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope The scope for the token.

@@ -48,0 +52,0 @@ */

@@ -176,2 +176,7 @@ /**

/**
* Tenant ID claim name. As used in Microsoft AAD tokens.
*/
export const TenantIdClaim = 'tid';
/**
* AppId used for creating skill claims when there is no appId and password configured.

@@ -178,0 +183,0 @@ */

@@ -7,2 +7,3 @@ // Copyright (c) Microsoft Corporation.

import { BotFrameworkClient } from '../skills';
import type { ConnectorClientOptions } from '../connectorApi/models';
import { ConversationIdHttpHeaderName } from '../conversationConstants';

@@ -13,18 +14,27 @@ import { ServiceClientCredentialsFactory } from './serviceClientCredentialsFactory';

import { ok } from 'assert';
import fetch from 'cross-fetch';
import axios from 'axios';
const botFrameworkClientFetchImpl: typeof fetch = async (input, init) => {
const url = z.string().parse(input);
const { body, headers } = z.object({ body: z.string(), headers: z.record(z.string()).optional() }).parse(init);
const response = await fetch(url, {
method: 'POST',
body,
headers,
const botFrameworkClientFetchImpl = (connectorClientOptions: ConnectorClientOptions): typeof fetch => {
const { http: httpAgent, https: httpsAgent } = connectorClientOptions?.agentSettings ?? {
http: undefined,
https: undefined,
};
const axiosInstance = axios.create({
httpAgent,
httpsAgent,
validateStatus: (): boolean => true,
});
return {
status: response.status,
json: async () => response.body,
} as Response;
return async (input, init?): Promise<Response> => {
const url = z.string().parse(input);
const { body, headers } = z.object({ body: z.string(), headers: z.record(z.string()).optional() }).parse(init);
const response = await axiosInstance.post(url, body, {
headers,
});
return {
status: response.status,
json: () => response.data,
} as Response;
};
};

@@ -41,2 +51,3 @@

* @param botFrameworkClientFetch A custom Fetch implementation to be used in the [BotFrameworkClient](xref:botframework-connector.BotFrameworkClient).
* @param connectorClientOptions A [ConnectorClientOptions](xref:botframework-connector.ConnectorClientOptions) object.
*/

@@ -46,7 +57,17 @@ constructor(

private readonly loginEndpoint: string,
private readonly botFrameworkClientFetch = botFrameworkClientFetchImpl
private readonly botFrameworkClientFetch?: ReturnType<typeof botFrameworkClientFetchImpl>,
private readonly connectorClientOptions?: ConnectorClientOptions
) {
ok(typeof botFrameworkClientFetch === 'function');
this.botFrameworkClientFetch ??= botFrameworkClientFetchImpl(this.connectorClientOptions);
ok(typeof this.botFrameworkClientFetch === 'function');
}
private toJSON() {
// Ignore ConnectorClientOptions, as it could contain Circular Structure behavior.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { connectorClientOptions, ...rest } = this;
return rest;
}
/**

@@ -53,0 +74,0 @@ * @template T The type of body in the InvokeResponse.

@@ -30,3 +30,7 @@ /**

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param channelAuthTenant Optional. The oauth token tenant.
* @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param oAuthScope Optional. The scope for the token.

@@ -33,0 +37,0 @@ * @param x5c Optional. Enables application developers to achieve easy certificates roll-over in Azure AD:

@@ -33,3 +33,7 @@ /**

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param tenantId Optional. The oauth token tenant.
* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param x5c Optional. Enables application developers to achieve easy certificates roll-over in Azure AD:

@@ -53,3 +57,7 @@ * set this parameter to send the public certificate (BEGIN CERTIFICATE) to Azure AD, so that Azure AD can use it to validate the subject name based on a trusted issuer policy.

* @param certificatePrivateKey A PEM encoded certificate private key.
* @param tenantId Optional. The oauth token tenant.
* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
*/

@@ -56,0 +64,0 @@ constructor(appId: string, x5c: string, certificatePrivateKey: string, tenantId?: string);

@@ -72,3 +72,3 @@ /**

// Is there an Issuer?
const issuer: string = token.payload.iss;
const issuer: string = token.payload[AuthenticationConstants.IssuerClaim];
if (!issuer) {

@@ -79,2 +79,19 @@ // No Issuer, means it's not from the Emulator.

//Validation to manage the issuer object as a string.
if (Array.isArray(ToBotFromBotOrEmulatorTokenValidationParameters.issuer)) {
const tenantId = token?.payload[AuthenticationConstants.TenantIdClaim] ?? '';
//Validate if there is an existing issuer with the same tid value.
if (
tenantId != '' &&
ToBotFromBotOrEmulatorTokenValidationParameters.issuer.find((issuer) => issuer.includes(tenantId)) ==
null
) {
//If the issuer doesn't exist, this is added using the Emulator token issuer structure.
//This allows use of the SingleTenant authentication through Emulator.
const newIssuer = AuthenticationConstants.ValidTokenIssuerUrlTemplateV1 + `${tenantId}/`;
ToBotFromBotOrEmulatorTokenValidationParameters.issuer.push(newIssuer);
}
}
// Is the token issues by a source we consider to be the emulator?

@@ -81,0 +98,0 @@ if (

@@ -50,3 +50,4 @@ /**

if (!authHeader.trim()) {
// eslint-disable-next-line prettier/prettier
if (!authHeader.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty header as part of that.
const isAuthDisabled = await credentials.isAuthenticationDisabled();

@@ -157,3 +158,4 @@ if (!isAuthDisabled) {

if (isPublicAzure(channelService)) {
if (serviceUrl.trim()) {
// eslint-disable-next-line prettier/prettier
if (serviceUrl.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty serviceUrl as part of that.
return await ChannelValidation.authenticateChannelTokenWithServiceUrl(

@@ -171,3 +173,4 @@ authHeader,

if (isGovernment(channelService)) {
if (serviceUrl.trim()) {
// eslint-disable-next-line prettier/prettier
if (serviceUrl.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty serviceUrl as part of that.
return await GovernmentChannelValidation.authenticateChannelTokenWithServiceUrl(

@@ -185,3 +188,4 @@ authHeader,

// Otherwise use Enterprise Channel Validation
if (serviceUrl.trim()) {
// eslint-disable-next-line prettier/prettier
if (serviceUrl.trim()) { // CodeQL [SM01513] We manually validate incoming tokens. Checking for empty serviceUrl as part of that.
return await EnterpriseChannelValidation.authenticateChannelTokenWithServiceUrl(

@@ -188,0 +192,0 @@ authHeader,

@@ -29,3 +29,7 @@ /**

* @param {string} appPassword The Microsoft app password.
* @param {string} channelAuthTenant Optional. The oauth token tenant.
* @param {string} channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
* @param {string} oAuthScope Optional. The scope for the token.

@@ -32,0 +36,0 @@ */

@@ -92,5 +92,3 @@ /**

auth.clientSecret =
typeof maybeAppIdOrAppPasswordOrCertificate === 'string'
? maybeAppIdOrAppPasswordOrCertificate
: undefined;
typeof maybeAppIdOrAppPasswordOrCertificate === 'string' ? maybeAppIdOrAppPasswordOrCertificate : '';

@@ -97,0 +95,0 @@ this.clientApplication = new ConfidentialClientApplication({ auth });

@@ -9,3 +9,3 @@ /**

import * as getPem from 'rsa-pem-from-mod-exp';
import getPem from 'rsa-pem-from-mod-exp';
import base64url from 'base64url';

@@ -12,0 +12,0 @@ import fetch from 'node-fetch';

@@ -207,3 +207,4 @@ // Copyright (c) Microsoft Corporation.

this.toChannelFromBotLoginUrl,
this.botFrameworkClientFetch
this.botFrameworkClientFetch,
this.connectorClientOptions
);

@@ -210,0 +211,0 @@ }

@@ -56,2 +56,6 @@ /**

* @param tenantId Tenant ID of the Azure AD tenant where the bot is created.
* * Required for SingleTenant app types.
* * Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
*
* More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
*/

@@ -58,0 +62,0 @@ constructor(appId: string, password: string, tenantId: string);

@@ -9,2 +9,4 @@ /**

import { AttachmentInfo, ChannelAccount, ConversationResourceResponse, ConversationsResult, PagedMembersResult, ResourceResponse } from "botframework-schema";
import type { Agent as HttpAgent } from "http";
import type { Agent as HttpsAgent } from "https";
export * from "botframework-schema";

@@ -21,5 +23,18 @@

baseUri?: string;
/**
* HTTP and HTTPS agents which will be used for every HTTP request (Node.js only).
*/
agentSettings?: AgentSettings;
}
/**
* HTTP and HTTPS agents (Node.js only)
*/
export interface AgentSettings {
http: HttpAgent;
https: HttpsAgent;
}
/**
* Optional Parameters.

@@ -26,0 +41,0 @@ */

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

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

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 too big to display

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

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