workflow-security-audit
БесплатноБез исполняемых скриптовНе проверенSecurity audit workflow for Magento custom code. Invokable standalone (audit the whole project's custom code) OR chained from…
от ProxiBlue★ 17 звёзд на GitHubОб этом скилле
/proxiblue-skills:workflow-security-audit
Security audit with Magento-specific patterns and pb-codegraph-aware impact propagation.
Invocation modes
Standalone — audit the full custom-code surface
/proxiblue-skills:workflow-security-audit
Audits all of app/code/<your-namespaces>/ + custom vendor/<your-namespaces>/. Produces a findings doc at .claude/security-audit/<timestamp>.md.
Chained — audit the current branch's diff (called from workflow-build-feature)
/proxiblue-skills:workflow-security-audit --diff-against=live
Audits ONLY files changed in the current branch vs live. Returns structured STATUS + findings (no doc written; output is the chain handoff).
Pre-flight
- Run
hostname && pwd— confirm in DDEV web container. - Run
git status --short— note any uncommitted changes (don't refuse; audit-only is read-only). - Verify pb-codegraph reachable:
mcp__pb-codegraph__list_reposreturns non-empty. If unreachable: continue with grep-only mode (skip impact checks).
Visible todo list
1. Determine scope (full custom-code OR diff vs live, based on --diff-against arg)
2. Enumerate files in scope
3. SQL injection patterns
4. XSS / output-escape patterns
5. CSRF / form_key patterns
6. Authentication / ACL patterns (admin controllers)
7. File upload patterns
8. Command injection patterns
9. Insecure deserialization patterns
10. Hardcoded secrets patterns
11. CSP / inline script patterns
12. Crypto pattern check
13. For each finding's risky symbol, pb-codegraph impact() to surface affected callers
14. Aggregate findings by severity, build STATUS verdict
15. Write findings doc (standalone mode) OR return chain handoff (diff mode)
Check details
Step 3 — SQL injection
Patterns to grep:
\$resource->getConnection\(\)->query\(.*\$
\->fetchAll\(.*\$
\->fetchRow\(.*\$
\->fetchOne\(.*\$
"SELECT[^"]*"\s*\.\s*\$
->query\([^)]*\.[^)]*\$
For each hit: read the surrounding context. Flag as Critical if the concatenated variable comes from request input. Important if from a model field that could be tampered with. Minor if from a configured constant.
Acceptable patterns (don't flag): ->select()->where('col = ?', $val), ->bindValue(...), parameterised queries via \Zend_Db_Expr.
Step 4 — XSS / unescaped output
In *.phtml:
<?=\s*\$
<\?php\s+echo\s+\$
echo\s+\$.*->getData\(
If the echo is NOT wrapped in $escaper->escapeHtml() / escapeUrl() / escapeJs() / escapeCss() / escapeHtmlAttr() → flag. Severity:
- Output of request data → Critical
- Output of admin-configured data → Important
- Output of static / system constants → Minor
Acceptable: <?= $escaper->escapeHtml($block->getFoo()) ?>, <?= $escaper->escapeUrl($block->getUrl()) ?>.
Step 5 — CSRF
For every admin controller's execute() that handles POST:
- Magento 2.4+ enforces form_key automatically for admin POST. Check
$this->getRequest()->isPost()followed by data mutation withoutformKeyValidator->validate()only on frontend controllers. - Custom REST/AJAX endpoints under
app/code/*/etc/webapi.xml— flag if<resource>anonymous</resource>without explicit comment justifying.
Step 6 — Auth / ACL
Admin controllers — find every controller under app/code/*/Controller/Adminhtml/:
grep -rln "extends.*\\\\Backend\\\\App\\\\Action" app/code/<namespaces>/
For each:
- Must implement
_isAllowed()returning$this->_authorization->isAllowed('SomeAcl::resource'). - If
_isAllowed()returnstrueunconditionally → Critical (ACL bypass). - If absent → Critical (default-deny isn't guaranteed; depends on parent class).
Step 7 — File upload
->save\(\$_FILES
move_uploaded_file
\\\\Magento\\\\Framework\\\\File\\\\Uploader
For each: confirm:
setAllowedExtensions(['png', 'jpg', ...])is called BEFORE savesetAllowRenameFiles(true)+setFilesDispersion(true)set- Destination NOT inside
pub/or anywhere directly web-accessible Missing any → Critical.
Step 8 — Command injection
shell_exec\s*\(
exec\s*\(
system\s*\(
passthru\s*\(
proc_open\s*\(
`[^`]*\$
Any hit involving variable interpolation → Critical. Static commands → Minor (still review; usually replaceable with native PHP).
Step 9 — Insecure deserialization
unserialize\s*\(
\\\\Magento\\\\Framework\\\\Unserialize
If the input comes from request / cookie / db field of unknown source → Critical. Use Magento\Framework\Serialize\Serializer\Json instead.
Step 10 — Hardcoded secrets
(api_?key|secret|password|token|bearer)\s*=\s*["'][^"']{12,}
Any hit not loaded from env.php / config.php / Magento\Framework\Encryption\EncryptorInterface → Critical.
Step 11 — CSP / inline scripts
In Hyva projects: inline <script> blocks in .phtml files violate the default CSP policy. Flag with Important + suggest moving to view/frontend/web/js/<name>.js with prop
Установить workflow-security-audit в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл workflow-security-audit?
Security audit workflow for Magento custom code. Invokable standalone (audit the whole project's custom code) OR chained from /proxiblue-skills:workflow-build-feature as a quality gate (audit only the current branch's diff). Checks for: SQL injection (raw query strings without binding, $resource->getConnection()->query() with concatenation), XSS (unescaped output in .phtml, missing escapeHtml/escapeUrl), CSRF (form keys, missing form_key inputs), authentication bypass (admin controllers missing _isAllowed), file upload risks, command injection (shell_exec / exec / system / passthru / `backticks` with user input), insecure deserialization (unserialize on user data), hardcoded secrets/credentials, insecure direct object reference (route params reaching $resource->load without ACL), CSP violations, weak crypto. Returns structured STATUS (PASS / PASS-WITH-NOTES / BLOCKING) + findings list with file:line + severity + suggested fix. Uses pb-codegraph impact() to chase callers of risky symbols across the project. Composes the existing security-scan skill (basic patterns) + new pb-codegraph-aware checks.
Как установить скилл workflow-security-audit?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл workflow-security-audit запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic