@salesforce/core 7.3.6 → 7.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/logger/filters.js +3 -0
- package/lib/org/authInfo.js +9 -1
- package/package.json +1 -1
package/lib/logger/filters.js
CHANGED
|
@@ -21,6 +21,7 @@ const FILTERED_KEYS = [
|
|
|
21
21
|
// Any json attribute that contains the words "refresh" and "token" will have the attribute/value hidden
|
|
22
22
|
{ name: 'refresh_token', regex: 'refresh[^\'"]*token' },
|
|
23
23
|
{ name: 'clientsecret' },
|
|
24
|
+
{ name: 'authcode' },
|
|
24
25
|
];
|
|
25
26
|
const FILTERED_KEYS_FOR_PROCESSING = FILTERED_KEYS.map((key) => ({
|
|
26
27
|
...key,
|
|
@@ -39,6 +40,8 @@ const replacementFunctions = FILTERED_KEYS_FOR_PROCESSING.flatMap((key) => [
|
|
|
39
40
|
(input) => input
|
|
40
41
|
.replace(new RegExp(sfdc_1.accessTokenRegex, 'g'), '<REDACTED ACCESS TOKEN>')
|
|
41
42
|
.replace(new RegExp(sfdc_1.sfdxAuthUrlRegex, 'g'), '<REDACTED AUTH URL TOKEN>'),
|
|
43
|
+
// conditional replacement for clientId: leave the value if it's the PlatformCLI, otherwise redact it
|
|
44
|
+
(input) => input.replace(/(['"]client.*Id['"])\s*:\s*(['"][^'"]*['"])/gi, (all, key, value) => value.includes('PlatformCLI') ? `${key}:${value}` : `${key}:"<REDACTED CLIENT ID>"`),
|
|
42
45
|
]);
|
|
43
46
|
const fullReplacementChain = compose(...replacementFunctions);
|
|
44
47
|
/**
|
package/lib/org/authInfo.js
CHANGED
|
@@ -49,6 +49,7 @@ const logger_1 = require("../logger/logger");
|
|
|
49
49
|
const sfError_1 = require("../sfError");
|
|
50
50
|
const sfdc_1 = require("../util/sfdc");
|
|
51
51
|
const stateAggregator_1 = require("../stateAggregator/stateAggregator");
|
|
52
|
+
const filters_1 = require("../logger/filters");
|
|
52
53
|
const messages_1 = require("../messages");
|
|
53
54
|
const sfdcUrl_1 = require("../util/sfdcUrl");
|
|
54
55
|
const connection_1 = require("./connection");
|
|
@@ -871,7 +872,14 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
871
872
|
authFields = await oauth2.requestToken((0, ts_types_1.ensure)(options.authCode));
|
|
872
873
|
}
|
|
873
874
|
catch (err) {
|
|
874
|
-
|
|
875
|
+
const msg = err instanceof Error ? `${err.name}::${err.message}` : typeof err === 'string' ? err : 'UNKNOWN';
|
|
876
|
+
const redacted = (0, filters_1.filterSecrets)(options);
|
|
877
|
+
throw sfError_1.SfError.create({
|
|
878
|
+
message: messages.getMessage('authCodeExchangeError', [msg]),
|
|
879
|
+
name: 'AuthCodeExchangeError',
|
|
880
|
+
...(err instanceof Error ? { cause: err } : {}),
|
|
881
|
+
data: ((0, ts_types_1.isArray)(redacted) ? redacted[0] : redacted),
|
|
882
|
+
});
|
|
875
883
|
}
|
|
876
884
|
const { orgId } = parseIdUrl(authFields.id);
|
|
877
885
|
let username = this.getUsername();
|