Skip to content

Commit 1822734

Browse files
committed
Fix string literal issue
1 parent 0859848 commit 1822734

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

shared/AppInsightsCore/Tests/Unit/src/ai/AppInsightsCommon.tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ export class ApplicationInsightsTests extends AITestClass {
395395
test: () => {
396396
// URLs with sensitive query parameters
397397
let config = {
398-
redactUrls: UrlRedactionOptions.append,
398+
redactUrls: UrlRedactionOptions.appendToDefault,
399399
redactQueryParams: ["authorize", "api_key", "password"]
400400
} as IConfiguration;
401401
const urlWithSensitiveParams = "https://example.com/api?Signature=secret&authorize=value";
@@ -412,7 +412,7 @@ export class ApplicationInsightsTests extends AITestClass {
412412
test: () => {
413413
// URLs with sensitive query parameters
414414
let config = {
415-
redactUrls: UrlRedactionOptions.replace,
415+
redactUrls: UrlRedactionOptions.replaceDefault,
416416
redactQueryParams: ["authorize", "api_key", "password"]
417417
} as IConfiguration;
418418
const urlWithSensitiveParams = "https://example.com/api?Signature=secret&authorize=value";

shared/AppInsightsCore/Tests/Unit/src/ai/ApplicationInsightsCore.Tests.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ export class ApplicationInsightsCoreTests extends AITestClass {
22152215
name: "FieldRedaction: should redact custom query parameters defined in redactQueryParams and replace custom queryParams",
22162216
test: () => {
22172217
let config = {
2218-
redactUrls: UrlRedactionOptions.replace,
2218+
redactUrls: UrlRedactionOptions.replaceDefault,
22192219
redactQueryParams: ["authorize", "api_key", "password"]
22202220
} as IConfiguration;
22212221

@@ -2229,7 +2229,7 @@ export class ApplicationInsightsCoreTests extends AITestClass {
22292229
name: "FieldRedaction: should redact both default and custom query parameters",
22302230
test: () => {
22312231
let config = {
2232-
redactUrls: UrlRedactionOptions.append,
2232+
redactUrls: UrlRedactionOptions.appendToDefault,
22332233
redactQueryParams: ["auth_token"]
22342234
} as IConfiguration;
22352235

@@ -2243,7 +2243,7 @@ export class ApplicationInsightsCoreTests extends AITestClass {
22432243
name: "FieldRedaction:should replace custom parameters redactQueryParams when user specifies the replace config",
22442244
test: () => {
22452245
let config = {
2246-
redactUrls: UrlRedactionOptions.replace,
2246+
redactUrls: UrlRedactionOptions.replaceDefault,
22472247
redactQueryParams: ["authorize", "api_key"]
22482248
} as IConfiguration;
22492249

@@ -2271,7 +2271,7 @@ export class ApplicationInsightsCoreTests extends AITestClass {
22712271
name: "FieldRedaction:should handle complex URLs with both credentials and custom query parameters",
22722272
test: () => {
22732273
let config = {
2274-
redactUrls: UrlRedactionOptions.append,
2274+
redactUrls: UrlRedactionOptions.appendToDefault,
22752275
redactQueryParams: ["authorize", "session_id"]
22762276
} as IConfiguration;
22772277

@@ -2617,7 +2617,7 @@ export class ApplicationInsightsCoreTests extends AITestClass {
26172617
name: "FieldRedaction: should handle custom parameters with multiple occurrences and empty values",
26182618
test: () => {
26192619
let config = {
2620-
redactUrls: UrlRedactionOptions.replace,
2620+
redactUrls: UrlRedactionOptions.replaceDefault,
26212621
redactQueryParams: ["auth_token", "session_id"]
26222622
} as IConfiguration;
26232623
const url = "https://example.com/path?auth_token=first&name=test&auth_token=&session_id=abc&session_id=";

shared/AppInsightsCore/src/enums/ai/UrlRedactionOptions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
/**
55
* Controls how the user can configure which parts of the URL should be redacted. Example, certain query parameters, username and password, etc.
6-
* @since <next_release_version>
7-
*/
6+
*/
7+
88
export const enum UrlRedactionOptions {
99
/**
1010
* The default value, will redact the username and password as well as the default set of query parameters
@@ -21,12 +21,12 @@ export const enum UrlRedactionOptions {
2121
* This will append any additional queryParams that the user has provided through redactQueryParams config to the default set i.e to
2222
* @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"].
2323
*/
24-
append = 3,
24+
appendToDefault = 3,
2525

2626
/**
2727
* This will replace the default set of query parameters to redact with the query parameters defined in redactQueryParams config, if provided by the user.
2828
*/
29-
replace = 4,
29+
replaceDefault = 4,
3030

3131
/**
3232
* This will redact username and password in the URL but will not redact any query parameters, even those in the default set.

shared/AppInsightsCore/src/utils/EnvUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,9 @@ function redactQueryParameters(url: string, config?: IConfiguration): string {
458458

459459
const option = config ? config.redactUrls : undefined;
460460

461-
if (option === UrlRedactionOptions.append) {
461+
if (option === UrlRedactionOptions.appendToDefault) {
462462
sensitiveParams = DEFAULT_SENSITIVE_PARAMS.concat(config.redactQueryParams);
463-
} else if (option === UrlRedactionOptions.replace) {
463+
} else if (option === UrlRedactionOptions.replaceDefault) {
464464
sensitiveParams = config.redactQueryParams;
465465
} else {
466466
sensitiveParams = DEFAULT_SENSITIVE_PARAMS;

0 commit comments

Comments
 (0)