@salesforce/core
Advanced tools
@@ -24,6 +24,5 @@ "use strict"; | ||
const logger = await logger_1.Logger.child('keyChain'); | ||
logger.debug(`platform: ${platform}`); | ||
const useGenericUnixKeychainVar = kit_1.env.getBoolean('SF_USE_GENERIC_UNIX_KEYCHAIN'); | ||
const shouldUseGenericUnixKeychain = useGenericUnixKeychainVar && useGenericUnixKeychainVar; | ||
if (platform.startsWith('win')) { | ||
logger.debug(`platform: ${platform}. Using generic Windows keychain.`); | ||
return keyChainImpl_1.keyChainImpl.generic_windows; | ||
@@ -34,6 +33,8 @@ } | ||
// automation user. | ||
if (shouldUseGenericUnixKeychain) { | ||
if (useGenericUnixKeychainVar) { | ||
logger.debug(`platform: ${platform}. Using generic Unix keychain.`); | ||
return keyChainImpl_1.keyChainImpl.generic_unix; | ||
} | ||
else { | ||
logger.debug(`platform: ${platform}. Using Darwin native keychain.`); | ||
return keyChainImpl_1.keyChainImpl.darwin; | ||
@@ -44,3 +45,4 @@ } | ||
// Use the generic keychain if specified | ||
if (shouldUseGenericUnixKeychain) { | ||
if (useGenericUnixKeychainVar) { | ||
logger.debug(`platform: ${platform}. Using generic Unix keychain.`); | ||
return keyChainImpl_1.keyChainImpl.generic_unix; | ||
@@ -51,2 +53,3 @@ } | ||
try { | ||
logger.debug(`platform: ${platform}. Using Linux keychain.`); | ||
await keyChainImpl_1.keyChainImpl.linux.validateProgram(); | ||
@@ -57,2 +60,3 @@ return keyChainImpl_1.keyChainImpl.linux; | ||
// If the builtin keychain is not available use generic | ||
logger.debug(`platform: ${platform}. Using generic Unix keychain.`); | ||
return keyChainImpl_1.keyChainImpl.generic_unix; | ||
@@ -59,0 +63,0 @@ } |
@@ -42,2 +42,3 @@ "use strict"; | ||
const lifecycleEvents_1 = require("../../lifecycleEvents"); | ||
const sfError_1 = require("../../sfError"); | ||
function chunk(array, chunkSize) { | ||
@@ -68,5 +69,7 @@ const final = []; | ||
catch (err) { | ||
if (err instanceof Error && err.name === 'JsonParseError') { | ||
const error = sfError_1.SfError.wrap(err); | ||
if (['JsonParseError', 'GenericKeychainInvalidPermsError'].includes(error.name)) { | ||
throw err; | ||
} | ||
this.logger.debug(`Error when reading auth file for user: ${username} due to: ${error.name}:${error.message}`); | ||
return null; | ||
@@ -90,3 +93,9 @@ } | ||
catch (e) { | ||
await lifecycleEvents_1.Lifecycle.getInstance().emitWarning(`The auth file for ${username} is invalid.`); | ||
const error = sfError_1.SfError.wrap(e); | ||
let warningMsg = `The auth file for ${username} is invalid.`; | ||
if (error.message) { | ||
warningMsg += ` Due to: ${error.message}`; | ||
} | ||
await lifecycleEvents_1.Lifecycle.getInstance().emitWarning(warningMsg); | ||
this.logger.debug(`Error when reading auth file for user: ${username} due to: ${error.name}:${error.message}`); | ||
} | ||
@@ -228,6 +237,10 @@ }); | ||
await this.read(username, false, false); | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const readConfig = this.configs.get(username); | ||
readConfig.setContentsFromObject(contents); | ||
return (await readConfig.write()); | ||
if (readConfig) { | ||
readConfig.setContentsFromObject(contents); | ||
return (await readConfig.write()); | ||
} | ||
else { | ||
this.logger.debug(`Failed to write auth file for ${username}. readConfig not found.`); | ||
} | ||
} | ||
@@ -234,0 +247,0 @@ } |
{ | ||
"name": "@salesforce/core", | ||
"version": "8.8.5", | ||
"version": "8.8.6", | ||
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1051415
0.1%22308
0.08%