Skip to content

Conversation

zerkz
Copy link
Contributor

@zerkz zerkz commented Oct 7, 2025

What does this PR do?

Add --sandbox-only flag that does checks on server start, via SOQL queries the field Organization.IsSandbox for each allowed org. If any of these orgs return false 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.

README.md Outdated
"args": ["-y", "@salesforce/mcp",
"--orgs", "DEFAULT_TARGET_ORG",
"--toolsets", "orgs,metadata,data,users",
"--tools", "run_apex_tests",
Copy link
Contributor Author

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) {
Copy link
Contributor Author

@zerkz zerkz Oct 7, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant