Skip to content

Commit

Permalink
fix: use PlatformCLI vs Platform CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
shetzel committed May 16, 2024
1 parent d6cd89c commit b6e94da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/logger/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ const replacementFunctions = FILTERED_KEYS_FOR_PROCESSING.flatMap(
input
.replace(new RegExp(accessTokenRegex, 'g'), '<REDACTED ACCESS TOKEN>')
.replace(new RegExp(sfdxAuthUrlRegex, 'g'), '<REDACTED AUTH URL TOKEN>'),
// conditional replacement for clientId: leave the value if it's the Platform CLI, otherwise redact it
// conditional replacement for clientId: leave the value if it's the PlatformCLI, otherwise redact it
(input: string): string =>
input.replace(/(['"]client.*Id['"])\s*:\s*(['"][^'"]*['"])/gi, (all, key: string, value: string) =>
value.includes('Platform CLI') ? `${key}:${value}` : `${key}:"<REDACTED CLIENT ID>"`
value.includes('PlatformCLI') ? `${key}:${value}` : `${key}:"<REDACTED CLIENT ID>"`
),
]);

Expand Down
6 changes: 3 additions & 3 deletions test/unit/logger/filterTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,18 @@ describe('filters', () => {
});
describe('clientId', () => {
it('default connected app', () => {
const input = { clientId: 'Platform CLI' };
const input = { clientId: 'PlatformCLI' };
const result = getUnwrapped(input);
expect(result).to.deep.equal(input);
});
it('default connected app (case insensitive)', () => {
const input = { ClientID: 'Platform CLI' };
const input = { ClientID: 'PlatformCLI' };
const result = getUnwrapped(input);
expect(result).to.deep.equal(input);
});
it('default connected app (case insensitive)', () => {
// eslint-disable-next-line camelcase
const input = { client_id: 'Platform CLI' };
const input = { client_id: 'PlatformCLI' };
const result = getUnwrapped(input);
expect(result).to.deep.equal(input);
});
Expand Down

3 comments on commit b6e94da

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - ubuntu-latest

Benchmark suite Current: b6e94da Previous: d6cd89c Ratio
Child logger creation 476733 ops/sec (±1.70%) 475076 ops/sec (±2.53%) 1.00
Logging a string on root logger 862215 ops/sec (±6.69%) 832464 ops/sec (±12.59%) 0.97
Logging an object on root logger 611321 ops/sec (±6.01%) 42238 ops/sec (±183.65%) 0.06909299696885925
Logging an object with a message on root logger 3459 ops/sec (±223.88%) 387254 ops/sec (±16.35%) 111.96
Logging an object with a redacted prop on root logger 420286 ops/sec (±7.51%) 483451 ops/sec (±8.66%) 1.15
Logging a nested 3-level object on root logger 374799 ops/sec (±8.06%) 21835 ops/sec (±185.10%) 0.0582578928972596

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Logger Benchmarks - ubuntu-latest'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: b6e94da Previous: d6cd89c Ratio
Logging an object with a message on root logger 3459 ops/sec (±223.88%) 387254 ops/sec (±16.35%) 111.96

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - windows-latest

Benchmark suite Current: b6e94da Previous: d6cd89c Ratio
Child logger creation 334510 ops/sec (±0.36%) 325778 ops/sec (±0.96%) 0.97
Logging a string on root logger 756195 ops/sec (±4.64%) 806261 ops/sec (±5.70%) 1.07
Logging an object on root logger 573962 ops/sec (±8.21%) 544642 ops/sec (±5.53%) 0.95
Logging an object with a message on root logger 8957 ops/sec (±198.87%) 7713 ops/sec (±191.34%) 0.86
Logging an object with a redacted prop on root logger 419463 ops/sec (±7.32%) 313268 ops/sec (±50.67%) 0.75
Logging a nested 3-level object on root logger 308076 ops/sec (±7.20%) 314213 ops/sec (±6.11%) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.