Skip to content

Commit

Permalink
fix: allow padding on id and secret
Browse files Browse the repository at this point in the history
  • Loading branch information
iowillhoit committed Oct 6, 2023
1 parent efc977a commit b93ac50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/org/authInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
sfdxAuthUrl: string
): Pick<AuthFields, 'clientId' | 'clientSecret' | 'refreshToken' | 'loginUrl'> {
const match = sfdxAuthUrl.match(
/^force:\/\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]*):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/
/^force:\/\/([a-zA-Z0-9._-]+={0,2}):([a-zA-Z0-9._-]*={0,2}):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/
);

if (!match) {
Expand Down
10 changes: 6 additions & 4 deletions test/unit/org/authInfoTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1669,16 +1669,18 @@ describe('AuthInfo', () => {
expect(options.loginUrl).to.equal('https://test.my.salesforce.com');
});

it('should parse the token that includes = for padding', () => {
it('should parse an id, secret, and token that include = for padding', () => {
const options = AuthInfo.parseSfdxAuthUrl(
'force://PlatformCLI::5Aep861_OKMvio5gy8xCNsXxybPdupY9fVEZyeVOvb4kpOZx5Z1QLB7k7n5flEqEWKcwUQEX1I.O5DCFwjlYU==@test.my.salesforce.com'
'force://3MVG9SemV5D80oBfPBCgboxuJ9cOMLWNM1DDOZ8zgvJGsz13H3J66coUBCFF3N0zEgLYijlkqeWk4ot_Q2.4o=:438437816653243682==:5Aep861_OKMvio5gy8xCNsXxybPdupY9fVEZyeVOvb4kpOZx5Z1QLB7k7n5flEqEWKcwUQEX1I.O5DCFwjlYU==@test.my.salesforce.com'
);

expect(options.refreshToken).to.equal(
'5Aep861_OKMvio5gy8xCNsXxybPdupY9fVEZyeVOvb4kpOZx5Z1QLB7k7n5flEqEWKcwUQEX1I.O5DCFwjlYU=='
);
expect(options.clientId).to.equal('PlatformCLI');
expect(options.clientSecret).to.equal('');
expect(options.clientId).to.equal(
'3MVG9SemV5D80oBfPBCgboxuJ9cOMLWNM1DDOZ8zgvJGsz13H3J66coUBCFF3N0zEgLYijlkqeWk4ot_Q2.4o='
);
expect(options.clientSecret).to.equal('438437816653243682==');
expect(options.loginUrl).to.equal('https://test.my.salesforce.com');
});

Expand Down

3 comments on commit b93ac50

@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: b93ac50 Previous: 79f6c6a Ratio
Child logger creation 508820 ops/sec (±0.52%) 440759 ops/sec (±15.45%) 0.87
Logging a string on root logger 586698 ops/sec (±20.54%) 564887 ops/sec (±21.66%) 0.96
Logging an object on root logger 434951 ops/sec (±16.74%) 332671 ops/sec (±10.12%) 0.76
Logging an object with a message on root logger 251005 ops/sec (±16.07%) 222079 ops/sec (±12.17%) 0.88
Logging an object with a redacted prop on root logger 3894 ops/sec (±223.45%) 10677 ops/sec (±195.34%) 2.74
Logging a nested 3-level object on root logger 238852 ops/sec (±13.14%) 141548 ops/sec (±35.35%) 0.59

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: b93ac50 Previous: 79f6c6a Ratio
Logging an object with a redacted prop on root logger 3894 ops/sec (±223.45%) 10677 ops/sec (±195.34%) 2.74

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: b93ac50 Previous: 79f6c6a Ratio
Child logger creation 508245 ops/sec (±0.65%) 399493 ops/sec (±40.10%) 0.79
Logging a string on root logger 580179 ops/sec (±7.68%) 574358 ops/sec (±11.75%) 0.99
Logging an object on root logger 358235 ops/sec (±19.49%) 396641 ops/sec (±17.27%) 1.11
Logging an object with a message on root logger 265142 ops/sec (±12.11%) 271881 ops/sec (±15.02%) 1.03
Logging an object with a redacted prop on root logger 271139 ops/sec (±19.92%) 265927 ops/sec (±22.04%) 0.98
Logging a nested 3-level object on root logger 13223 ops/sec (±186.30%) 12963 ops/sec (±186.55%) 0.98

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

Please sign in to comment.