Skip to content

Commit

Permalink
Merge pull request #200 from salesforcecli/sm/security-warnings
Browse files Browse the repository at this point in the history
Sm/security-warnings
  • Loading branch information
cristiand391 authored Sep 29, 2021
2 parents a7bdcb3 + e6f6ac2 commit 851ac03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion messages/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
"AlphaNumericNameError": "Name must contain only alphanumeric characters.",
"NameMustStartWithLetterError": "Name must start with a letter.",
"EndWithUnderscoreError": "Name can't end with an underscore.",
"DoubleUnderscoreError": "Name can't contain 2 consecutive underscores."
"DoubleUnderscoreError": "Name can't contain 2 consecutive underscores.",

"SecurityWarning": "This command will expose sensitive information that allows for subsequent activity using your current authenticated session.\nSharing this information is equivalent to logging someone in under the current credential, resulting in unintended access and escalation of privilege.\nFor additional information, please review the authorization section of the https://developer.salesforce.com/docs/atlas.en-us.234.0.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm"
}
4 changes: 3 additions & 1 deletion src/commands/force/org/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { OrgListUtil } from '../../../shared/orgListUtil';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'display');

const sharedMessages = Messages.loadMessages('@salesforce/plugin-org', 'messages');
export class OrgDisplayCommand extends SfdxCommand {
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessage('examples').split(os.EOL);
Expand Down Expand Up @@ -68,6 +68,8 @@ export class OrgDisplayCommand extends SfdxCommand {
}

private print(result: OrgDisplayReturn): void {
this.ux.warn(sharedMessages.getMessage('SecurityWarning'));
this.ux.log('');
const columns = {
columns: [
{ key: 'key', label: 'KEY' },
Expand Down
5 changes: 5 additions & 0 deletions src/commands/force/org/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { openUrl } from '../../../shared/utils';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'open');
const sharedMessages = Messages.loadMessages('@salesforce/plugin-org', 'messages');

export class OrgOpenCommand extends SfdxCommand {
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessage('examples').split(EOL);
Expand All @@ -37,6 +39,9 @@ export class OrgOpenCommand extends SfdxCommand {
const username = this.org.getUsername();
const output = { orgId, url, username };

this.ux.warn(sharedMessages.getMessage('SecurityWarning'));
this.ux.log('');

if (new Env().getBoolean('SFDX_CONTAINER_MODE')) {
// instruct the user that they need to paste the URL into the browser
this.ux.styledHeader('Action Required!');
Expand Down

0 comments on commit 851ac03

Please sign in to comment.