Code Security Scan
code_security_scanScan custom Drupal PHP/JS code for XSS, SQL injection, command injection, secrets, CSRF, access-control, and deprecated APIs, with Drupal-aware false-positive rules and fix recommendations.
Instructions
Scan custom code for vulnerability patterns — no tools to install.
Matches PHP/JS/Drupal files against a curated registry of XSS, SQL injection, command injection, path traversal, hardcoded secrets, access-control, CSRF, and deprecated-API patterns, with Drupal-aware false-positive rules (EntityQuery conditions, stream wrappers, escapeshellarg, and similar safe APIs are recognized). The counterpart of security_scan, which needs PHPStan installed.
Target one module by machine name, or a directory relative to DRUPAL_ROOT; with neither, the site's own modules/ and themes/ directories are scanned (contrib and core excluded). categories narrows to registry keys ('xss', 'sql_injection', 'command_injection', 'path_traversal', 'hardcoded_secrets', 'access_control', 'csrf', 'deprecated_api'); severity narrows to one level. Findings carry file, line, snippet, and a fix recommendation; counts cover the full run even when max_findings truncates the list.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| module | No | ||
| severity | No | ||
| categories | No | ||
| max_findings | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||