Install AI Tools

B2C Commerce tools, documentation, and skills for your assistant.

Claude

Using Claude Desktop? See Claude Desktop (Cowork) setup.

Install the plugin Recommended

bash
claude plugin marketplace add SalesforceCommerceCloud/b2c-developer-tooling
claude plugin install b2c-dx-mcp@b2c-developer-tooling

Start a new Claude Code session. To install for the current project only, run it from your project directory with --scope project.

Turn on auto-update

Claude Code does not auto-update third-party marketplaces by default, so installed plugins stay on the version you installed. To get new releases automatically, run /plugin, open Marketplaces, select b2c-developer-tooling, and choose Enable auto-update. Claude Code then checks for updates when a session starts; run /reload-plugins or start a new session to load them.

Manual MCP setup
bash
claude mcp add --transport stdio --scope user b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest

Start a new session. To configure the current project only, run it from your project directory with --scope project. See Claude Code MCP setup.

Codex/ChatGPT

Using the ChatGPT desktop app (ChatGPT Work)? See ChatGPT Work setup.

Install the plugin Recommended

bash
codex plugin marketplace add SalesforceCommerceCloud/b2c-developer-tooling
codex plugin add b2c-dx-mcp@b2c-developer-tooling

Start a new Codex session in your project. Codex plugins also work in ChatGPT Work.

Manual MCP setup
bash
codex mcp add b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest

Or add this to ~/.codex/config.toml (or $CODEX_HOME/config.toml if customized):

toml
[mcp_servers.b2c-dx-mcp]
command = "npx"
args = ["-y", "@salesforce/b2c-dx-mcp@latest"]

Start a new session. See Codex MCP configuration.

VS Code

Install the plugin Recommended

  1. Open the Command Palette (Cmd/Ctrl+Shift+P) and run Chat: Install Plugin from Source.
  2. Enter SalesforceCommerceCloud/b2c-developer-tooling.
  3. Select b2c-dx-mcp and follow the installation prompts.
  4. Start a new chat in GitHub Copilot.
Manual MCP setup

Add this to .vscode/mcp.json in your workspace:

json
{
  "servers": {
    "b2c-dx-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@salesforce/b2c-dx-mcp@latest"]
    }
  }
}

See VS Code MCP setup.

Copilot CLI setup

Cursor

Reload the MCP server in Cursor after installation.

Manual MCP setup

Add this to .cursor/mcp.json in your project:

json
{
  "mcpServers": {
    "b2c-dx-mcp": {
      "command": "npx",
      "args": ["-y", "@salesforce/b2c-dx-mcp@latest"]
    }
  }
}

For all projects, use ~/.cursor/mcp.json instead.

See Cursor's MCP documentation.

OpenCode

Add this to opencode.json in your project:

json
{
  "mcp": {
    "b2c-dx-mcp": {
      "type": "local",
      "command": ["npx", "-y", "@salesforce/b2c-dx-mcp@latest"],
      "enabled": true
    }
  }
}

Restart OpenCode. For all projects, use ~/.config/opencode/opencode.json. See OpenCode MCP setup.

Gemini

Run:

bash
gemini mcp add --scope user b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest

Start a new Gemini CLI session. To configure the current project only, run it from your project directory with --scope project. See Gemini CLI MCP setup.

No separate skills plugins needed.

Other clients and manual setup →
Skip to content
View as Markdown
View as Markdown

Security Commands ​

Preview

The security commands are a preview. Rules, output fields, and flags may change before they are stable.

Scan cartridge code for security problems such as open redirects, object query injection, weak cryptography, and hardcoded credentials. Scans run locally, need no credentials or instance, and finish in well under a second for a typical storefront. See Code Security for an overview and Security Rules for what each rule finds and how to fix it.

b2c security scan ​

Scan the server-side scripts in your cartridges and the site data in your project. Directories are searched for cartridges (folders with a .project file); inside them, .js and .ds files are scanned except under cartridge/client/, cartridge/static/, and node_modules/, and except minified files. Directories are also searched for site import/export data, such as a site_template folder: services.xml, preferences.xml, attribute definitions, csrf-whitelists.xml, and OCAPI settings (ocapi-settings/wapi_*_config.json). Files you name directly are always scanned.

Usage ​

bash
b2c security scan [paths...]

Arguments ​

ArgumentDescriptionRequired
pathsFiles or directories to scan. Accepts several.No (defaults to the project directory: --project-directory, or the current directory)

Flags ​

FlagDescriptionDefault
--formatReport format: table, json, or sarif (for GitHub code scanning)table
--outputWrite the json or sarif report to this file instead of standard output
--severityOnly report findings at or above this severity: critical, high, medium, low, or infoall
--fail-onExit with status 1 when open findings at or above this severity remain; none never failslow
--ruleRun only this rule. Repeatable.all rules
--exclude-ruleSkip this rule. Repeatable.
--ignoreLeave out files matching this glob, relative to the project directory (for example 'cartridges/bm_*'). Repeatable.
--baselineBaseline file of accepted findings (see b2c security baseline).b2c-security-baseline.json when it exists
--all-cartridgesCombine routes across every cartridge in the project, not only those on the cartridge path (see Cartridge path)false
--exclude-reference-cartridgesLeave out findings in SFRA and SiteGenesis reference cartridges (see Reference cartridges)false
--show-suppressedAlso list findings that are suppressed inline or in the baselinefalse

Examples ​

bash
# Scan every cartridge under the current directory
b2c security scan

# Scan one cartridge
b2c security scan cartridges/app_custom

# Report medium and above, and fail CI only for high and critical findings
b2c security scan --severity medium --fail-on high

# Write SARIF for GitHub code scanning
b2c security scan --format sarif --output security.sarif

# Run specific rules
b2c security scan --rule open-redirect --rule object-query-injection

# Machine-readable output
b2c security scan --json

Output ​

Findings are grouped by file, with line and column, severity, rule, and message, followed by a summary:

text
cartridges/app_custom/cartridge/controllers/Account.js
  42:18   medium  open-redirect            Redirect destination can be chosen through the request; this allows redirects to other sites.

cartridges/app_custom/cartridge/scripts/helpers/subscription.js
  17:60   high    object-query-injection   The query string passed to queryCustomObject() is built by concatenation; pass values as {0}-style query arguments instead.

2 open finding(s) (1 high, 1 medium) in 214 file(s); 0 suppressed, 0 baselined.

A finding is open unless an inline comment suppresses it or it matches the baseline. The command exits with status 1 when open findings at or above --fail-on remain.

With --json (or --format json), the result has findings (each with ruleId, severity, confidence, category, cwe, message, location, snippet, remediation, docsUrl, fingerprint, and suppression, baselined, or referenceCartridge when they apply), errors for files that could not be parsed, rules, filesScanned, indexedEndpoints, hiddenReferenceFindings, and a summary with counts. With --format sarif, the report is SARIF 2.1.0, including security-severity scores that GitHub code scanning uses to rank alerts.

Reference cartridges ​

Findings in the cartridges that ship with SFRA (app_storefront_base, bm_app_storefront_base, modules) and SiteGenesis (app_storefront_controllers, app_storefront_core, app_storefront_pipelines) are reported and marked [reference cartridge] (referenceCartridge in JSON). They are real for any storefront that deploys those cartridges, even though you usually don't edit them: fix them from your own cartridge, for example with server.prepend() for a missing CSRF check, or accept them in the baseline. Use --exclude-reference-cartridges to leave them out.

Cartridge path ​

Route rules combine SFRA routes across the cartridges on your cartridge path (server.extend(module.superModule) with append, prepend, and replace), even when you scan only some paths. Set cartridges in dw.json (or SFCC_CARTRIDGES; a colon-separated path copied from Business Manager works) to your site's cartridge path. See cartridge order for what's used when it isn't set.

Files in cartridges that aren't on the path are still scanned, but their findings are marked [not on cartridge path] (notOnPathCartridge in JSON): the site doesn't run that code. Pass --all-cartridges to combine routes as if the site ran every cartridge in the project.

Suppressing a finding ​

To accept a finding in code, add a comment that names the rule on the line before it, or at the end of the line. A reason after -- is optional and appears in JSON and SARIF output.

js
// b2c-dx-disable-next-line open-redirect -- target checked by isAllowedRedirect()
res.redirect(target);

res.redirect(target); // b2c-dx-disable-line open-redirect

A suppression must name the rule; several rules can be listed, separated by commas or spaces. In XML site data, use an XML comment and separate the reason with a single hyphen, because XML comments can't contain --:

xml
<!-- b2c-dx-disable-next-line service-insecure-url - mock endpoint on the sandbox network -->
<url>http://erp-mock.internal.example.com/orders</url>

Project settings ​

To turn rules off, change their severity, or leave out paths for everyone who scans the project, commit a .b2c-security.json in the project directory, or put the same settings under a security key in dw.json (which takes precedence over the file). scan, baseline, and the MCP security_scan tool read them.

json
{
  "ignore": ["cartridges/bm_*"],
  "rules": {
    "pii-in-logs": "off",
    "weak-crypto": "low",
    "dynamic-code": {"ignore": ["cartridges/int_legacy"]}
  }
}
  • ignore: globs (relative to the project directory) of files not to scan. A directory covers everything inside it.
  • rules: per rule ID, "off", a severity, or {"severity": ..., "ignore": [...]} to drop that rule's findings in some paths.
  • An unknown rule ID is an error, so a typo doesn't leave a rule on unnoticed. The summary shows the settings file it used.

In dw.json:

json
{
  "hostname": "my-sandbox.example.com",
  "security": {"ignore": ["cartridges/bm_*"], "rules": {"pii-in-logs": "off"}}
}

Notes ​

  • Files that use legacy script syntax, type annotations (var x : String, common in .ds files) or E4X XML literals (<product/>, xml..child), can't be parsed and are skipped; the summary reports how many of each. Use --json to list them (each error has a reason).
  • Rules follow common SFRA and SiteGenesis patterns and report what they can decide from one file. Treat medium and low confidence findings as prompts to review the code.

b2c security rules ​

List the rules that b2c security scan runs, with severity, category, CWE, and a description.

Usage ​

bash
b2c security rules [--json]

b2c security baseline ​

Record the current findings in a baseline file so later scans report only new findings. Use this to adopt scanning on an existing codebase: commit the baseline, fix findings over time, and regenerate it as you go. Findings suppressed inline are not recorded.

Baseline entries match on the rule, the file, and the text of the line, so they survive code moving up or down. Editing the line makes the finding new again.

Usage ​

bash
b2c security baseline [paths...]

Flags ​

FlagDescriptionDefault
--outputBaseline file to write.b2c-security-baseline.json
--ruleInclude only this rule. Repeatable.all rules
--exclude-ruleSkip this rule. Repeatable.
--ignoreLeave out files matching this glob. Repeatable.

Examples ​

bash
# Accept today's findings, then scan for new ones
b2c security baseline
b2c security scan