Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

b2c-security

БесплатноБез исполняемых скриптовНе проверен

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

SalesforceCommerceCloudот SalesforceCommerceCloud★ 58 звёзд на GitHub

Об этом скилле

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
Полный SKILL.md на GitHub

Установить b2c-security в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/trigger-evals.json

FAQ

Что делает скилл b2c-security?

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.

Как установить скилл b2c-security?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл b2c-security запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить b2c-security с