Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sm/security-warnings #200

Merged
merged 3 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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