-
Notifications
You must be signed in to change notification settings - Fork 51
Add --sandbox-only flag to force check of allowed orgs to ensure they are only Sandboxes. #288
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
base: main
Are you sure you want to change the base?
Conversation
Fix apex tests tool name in readme for mcp json example.
README.md
Outdated
"args": ["-y", "@salesforce/mcp", | ||
"--orgs", "DEFAULT_TARGET_ORG", | ||
"--toolsets", "orgs,metadata,data,users", | ||
"--tools", "run_apex_tests", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused as to why this diff is appearing, I already fixed this over in #272
const productionOrgs: string[] = []; | ||
|
||
// eslint-disable-next-line no-await-in-loop | ||
for (const org of allowedOrgs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could possibly speed up this section/logic by putting this unit of work into it's own promise, tossing it in an array, and doing Promise.all()
. Might get rid of the need for all these eslint disables!
What does this PR do?
Add
--sandbox-only
flag that does checks on server start, via SOQL queries the fieldOrganization.IsSandbox
for each allowed org. If any of these orgs returnfalse
for IsSandbox, we abort the server start/throw an error.This gives users the ability opt in for an extra layer of security/safety.
The decision to check only at server start is a mixture of not slowing down everything (by checking before every org interaction/tool command), and the unlikely prospect of a developer re-authing a production org over the same alias post-server start. It's a tradeoff that I think makes sense.
What issues does this PR fix or reference?
https://github.com/salesforcecli/mcp/discussions/122
unit tests included and tested against my developer edition org.