Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure-tools/test-recorder

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure-tools/test-recorder - npm Package Compare versions

Comparing version 3.1.2 to 3.2.0

dist-esm/src/utils/fallbackSanitizers.js

3

dist-esm/src/recorder.js

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

import { decodeBase64 } from "./utils/encoding";
import { fallbackSanitizers } from "./utils/fallbackSanitizers";
/**

@@ -222,2 +223,4 @@ * This client manages the recorder life cycle and interacts with the proxy-tool to do the recording,

await handleEnvSetup(this.httpClient, Recorder.url, this.recordingId, options.envSetupForPlayback);
// Fallback sanitizers to be added in both record/playback modes
await fallbackSanitizers(this.httpClient, Recorder.url, this.recordingId);
// Sanitizers to be added only in record mode

@@ -224,0 +227,0 @@ if (isRecordMode() && options.sanitizerOptions) {

@@ -683,2 +683,121 @@ 'use strict';

// Licensed under the MIT license.
const JSON_BODY_KEYS_TO_REDACT = [
"authHeader",
"accountKey",
"accessToken",
"accountName",
"applicationId",
"apiKey",
"client_secret",
"connectionString",
"url",
"host",
"password",
"userName",
"applicationSecret",
"aliasSecondaryConnectionString",
"aliasPrimaryConnectionString",
"primaryKey",
"secondaryKey",
"adminPassword.value",
"administratorLoginPassword",
"runAsPassword",
"adminPassword",
"accessSAS",
"WEBSITE_AUTH_ENCRYPTION_KEY",
"decryptionKey",
"primaryMasterKey",
"primaryReadonlyMasterKey",
"secondaryMasterKey",
"secondaryReadonlyMasterKey",
"certificatePassword",
"clientSecret",
"keyVaultClientSecret",
"authHeader",
"httpHeader",
"encryptedCredential",
"appkey",
"functionKey",
"atlasKafkaPrimaryEndpoint",
"atlasKafkaSecondaryEndpoint",
"certificatePassword",
"storageAccountPrimaryKey",
"privateKey",
"fencingClientPassword",
"acrToken",
"scriptUrlSasToken",
"azureBlobSource.containerUrl",
"properties.DOCKER_REGISTRY_SEVER_PASSWORD",
];
const BODY_REGEXES_TO_REDACT = [
"(?:(Password|User ID)=)(?<secret>.*)(?:;)",
"client_secret=(?<secret>[^&]+)",
"<PrimaryKey>(?<secret>.*?)</PrimaryKey>",
"<SecondaryKey>(?<secret>.*?)</SecondaryKey>",
"<UserDelegationKey>.*?<SignedOid>(?<secret>.*?)</SignedOid>.*?</UserDelegationKey>",
"<UserDelegationKey>.*?<SignedTid>(?<secret>.*?)</SignedTid>.*?</UserDelegationKey>",
"<UserDelegationKey>.*?<Value>(?<secret>.*?)</Value>.*?</UserDelegationKey>",
'SharedAccessKey=(?<secret>[^;\\"]+)',
'AccountKey=(?<secret>[^;\\"]+)',
'accesskey=(?<secret>[^;\\"]+)',
'AccessKey=(?<secret>[^;\\"]+)',
'Secret=(?<secret>[^;\\"]+)',
"access_token=(?<secret>.*?)(?=&|$)",
"refresh_token=(?<secret>.*?)(?=&|$)",
'(?:(sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\"]*)',
];
const URL_REGEX = "(?<=http://|https://)([^/?]+)";
const HEADER_KEYS_TO_REDACT = [
"Ocp-Apim-Subscription-Key",
"api-key",
"x-api-key",
"subscription-key",
"x-ms-encryption-key",
"sshPassword",
];
async function fallbackSanitizers(httpClient, url, recordingId) {
const bodyKeySanitizers = JSON_BODY_KEYS_TO_REDACT.map((prop) => ({
jsonPath: `$..${prop}`, // Handles the request body
value: "REDACTED",
}));
const generalSanitizers = BODY_REGEXES_TO_REDACT.map((regex) => ({
value: "REDACTED",
regex: true,
groupForReplace: "secret",
target: regex,
}));
const headerSanitizers = [
{
key: "Operation-location",
groupForReplace: "secret",
regex: true,
target: URL_REGEX,
value: "REDACTED",
},
{
key: "ServiceBusDlqSupplementaryAuthorization",
groupForReplace: "secret",
regex: true,
target: '(?:(sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\"]+)',
value: "REDACTED",
},
{
key: "ServiceBusSupplementaryAuthorization",
groupForReplace: "secret",
regex: true,
target: '(?:(sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\"]+)',
value: "REDACTED",
},
];
const headersForRemoval = HEADER_KEYS_TO_REDACT;
await addSanitizers(httpClient, url, recordingId, {
bodyKeySanitizers,
generalSanitizers,
removeHeaderSanitizer: { headersForRemoval },
headerSanitizers,
});
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
var _a;

@@ -888,2 +1007,4 @@ /**

await handleEnvSetup(this.httpClient, Recorder.url, this.recordingId, options.envSetupForPlayback);
// Fallback sanitizers to be added in both record/playback modes
await fallbackSanitizers(this.httpClient, Recorder.url, this.recordingId);
// Sanitizers to be added only in record mode

@@ -890,0 +1011,0 @@ if (isRecordMode() && options.sanitizerOptions) {

2

package.json
{
"name": "@azure-tools/test-recorder",
"version": "3.1.2",
"version": "3.2.0",
"sdk-type": "utility",

@@ -5,0 +5,0 @@ "description": "This library provides interfaces and helper methods to provide recording and playback capabilities for the tests in Azure JS/TS SDKs",

@@ -78,3 +78,3 @@ /**

*/
type BodyKeySanitizer = {
export type BodyKeySanitizer = {
regex?: string;

@@ -267,3 +267,2 @@ value?: string;

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

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