Skip to content

Commit c96edc9

Browse files
Merge pull request #22 from salesforcecli/sm/unencrypted-access-token-on-list
fix: unencrypt access tokens on org:list
2 parents 41b74d6 + b61c8af commit c96edc9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/commands/force/org/list.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export class OrgListCommand extends SfdxCommand {
107107
} catch (e) {
108108
const err = e as SfdxError;
109109
this.logger.debug(`Error cleaning org ${fields.username}: ${err.message}`);
110+
this.ux.warn(
111+
`Unable to clean org with username ${fields.username}. You can run "sfdx force:org:delete -u ${fields.username}" to remove it.`
112+
);
110113
}
111114
})
112115
);

src/shared/orgListUtil.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ export class OrgListUtil {
133133
const config = (await ConfigAggregator.create()).getConfig();
134134

135135
for (const authInfo of authInfos) {
136-
const currentValue = OrgListUtil.removeRestrictedInfoFromConfig(authInfo.getFields()) as ExtendedAuthFields;
136+
let currentValue: ExtendedAuthFields;
137+
try {
138+
currentValue = OrgListUtil.removeRestrictedInfoFromConfig(authInfo.getFields(true));
139+
} catch (error) {
140+
const logger = await OrgListUtil.retrieveLogger();
141+
logger.warn(`Error decrypting ${authInfo.getUsername()}`);
142+
currentValue = OrgListUtil.removeRestrictedInfoFromConfig(authInfo.getFields());
143+
}
144+
137145
const [alias, lastUsed] = await Promise.all([
138146
getAliasByUsername(currentValue.username),
139147
fs.stat(join(Global.DIR, `${currentValue.username}.json`)),

0 commit comments

Comments
 (0)