Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

b2c-security

FreeNo executable scriptsNot checked

Find and fix security problems in B2C Commerce code and site data with the b2c CLI. Covers cartridge JavaScript (SFRA, SiteGenesis, custom cartridges) and…

SalesforceCommerceCloudby SalesforceCommerceCloud★ 58 GitHub stars

About this skill

B2C Security Skill

Use b2c security scan (preview) to find security problems in B2C Commerce cartridge code, then triage and fix them. The scan runs locally on the working tree, needs no instance or credentials, and takes well under a second for a typical storefront.

Tip: If b2c is not installed globally, use npx @salesforce/b2c-cli instead.

MCP parity: If the b2c-dx-mcp server is connected, security_scan covers b2c security scan with the same rules, suppressions, and baseline. Route findings depend on cartridge order: check cartridgePathSource and pass siteId to use a site's path from the instance.

Scan

# Scan all cartridges under the current directory (folders with a .project file)
b2c security scan

# Scan one cartridge or file
b2c security scan cartridges/app_custom

# Structured output for analysis (prefer this when you will read the results)
b2c security scan --json

# List the rules and what they find
b2c security rules

Findings in SFRA and SiteGenesis base cartridges (app_storefront_base, modules, app_storefront_controllers, ...) are reported with referenceCartridge set. They are real for any storefront that deploys those cartridges; fix them from the project's own cartridge (for example server.prepend()), not by editing the base. --exclude-reference-cartridges leaves them out.

Site data in the project (such as a site_template folder) is checked too: services.xml, preferences.xml, attribute definitions, csrf-whitelists.xml, and OCAPI settings JSON. Server-side .js and .ds files are scanned; cartridge/client/, cartridge/static/, node_modules/, and minified files are skipped. Legacy .ds files with type annotations can't be parsed yet and are reported under errors.

Triage findings

Each finding in --json output has ruleId, severity, confidence, message, location (file, startLine, startColumn), snippet, remediation, and docsUrl.

  1. Read the code around each finding before changing it. Rules decide from one file at a time.
  2. Treat confidence: high findings as real unless the code proves otherwise.
  3. For medium and low confidence, check what the rule could not see: whether a redirect target is validated in a helper, whether a "secret" is a test value, whether a query value is constant.
  4. Explain each finding to the user in terms of impact (what an attacker could do) and the fix.

Rule references, with examples and fixes: b2c docs search "security rules" or the docsUrl on each finding.

Fix patterns

Rule Fix
object-query-injection Use {0} placeholders and pass values as arguments: queryCustomObject(type, 'custom.email = {0}', email)
file-path-from-request Return a directory from the processMultipart() callback (the platform names the file), or generate the name (UUID) with an allowlisted extension; return null for unexpected fields
open-redirect Redirect to URLUtils URLs, or check the target against an allowlist before res.redirect()
hardcoded-credentials Move the value to a service credential (read via LocalServiceRegistry) or a password site preference; rotate it
weak-crypto Cipher with AES/GCM/NoPadding; MessageDigest/Mac with SHA-256 or stronger; avoid the Weak* classes
insecure-cookie cookie.setSecure(true) and cookie.setHttpOnly(true) before response.addHttpCookie(cookie)
ocapi-demo-client-id Replace the demo client ID aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa with a dedicated Account Manager client; remove it from OCAPI settings on every instance
ocapi-broad-access Grant specific resources and methods; allow only your own HTTPS origins
Full SKILL.md on GitHub

Install b2c-security in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

evals/trigger-evals.json

FAQ

What does the b2c-security skill do?

Find and fix security problems in B2C Commerce code and site data with the b2c CLI. Covers cartridge JavaScript (SFRA, SiteGenesis, custom cartridges) and site import/export data (OCAPI settings, services.xml, preferences). Use when the user asks to check code or a site_template for security issues, asks whether a specific snippet is safe (a query or redirect built from request input, credentials in code, crypto choices), audits a storefront before launch, reviews OCAPI settings or service credentials before an import, sets up security scanning in CI, or fixes findings such as open redirects, object query injection, CSRF gaps, weak crypto, hardcoded credentials, insecure cookies, mass assignment, or the OCAPI demo client ID.

How do I install the b2c-security skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the b2c-security skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare b2c-security with