Security
Audits a project's dependency and infrastructure security — runs composer/npm audit, checks CMS (Drupal core + contrib) security advisories, reviews the Docker setup, ranks every finding by exploitable criticality, and either applies safe fixes or gives exact step-by-step remediation. Tuned for Drupal/PHP + Docker. Use when the user asks for a security audit, a CVE/vulnerability check, a dependency-security pass, or invokes /clara:security.From its SKILL.md
npx -y skills add tarto-dev/clara-claude-skills --skill securityAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
14.3 KB, as published. Nobody here has run it
Clara — Security Audit
Run a dependency- and infrastructure-level security audit and return a prioritised, actionable report. Real exploitability over raw advisory counts. Be direct: state what is vulnerable, how bad it is in this project, and the exact remediation.
This is a defensive audit — find and fix weaknesses, not exploit them.
Scope first
Detect the stack before running anything — don't run an audit for a tool the project doesn't use. From the project root:
ls composer.json composer.lock package.json package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null
ls Dockerfile docker-compose.yml docker-compose.yaml compose.yaml 2>/dev/null
Then identify:
- PHP —
composer.json/composer.lockpresent. - CMS — read
composer.json:drupal/core*→ Drupal;roots/wordpressor awp-content/tree → WordPress; otherwise treat as plain PHP/JS. Drupal is the primary target here. - JS — which lockfile is present picks the runner (
package-lock.json→ npm,pnpm-lock.yaml→ pnpm,yarn.lock→ yarn). Don't runnpm auditagainst a pnpm project. - Docker — any Dockerfile / compose file.
Find the project runner the same way the other Clara skills do — lando, ddev, or docker compose exec <svc>. Run composer/drush inside the runner if one exists (the host PHP version rarely matches), but *audit against the committed lockfile is fine from the host too.
State up front which ecosystems you found and will audit; skip the rest explicitly.
Run the audits
Prefer real signals over guesswork. Run what applies, capture the output, never invent advisory IDs.
Two things are mandatory and complementary — do BOTH, never just one:
- Read the package/lock files (
composer.lock,package-lock.json/pnpm-lock.yaml/yarn.lock) to extract the exact installed versions of every package. The lockfile is the ground truth for "what is actually installed". But note: a lockfile contains NO CVE/advisory data — only versions and an optionalabandonedflag. Reading it is necessary but never sufficient. - Run the real audit (
composer audit,npm audit,drush pm:security) which fetches the advisory database over the network and maps installed versions → CVE/GHSA/SA ids. This is where the actual vulnerability signal comes from.
Reading the lockfile alone gets you hygiene findings (abandoned, pre-release versions) but will MISS every real CVE. Always pair the two: extract versions from the lock, then cross-reference them against advisories.
Where to run — runner first, then host, then offline fallback
Try in this order; don't stop at the first failure, escalate to the next:
- Inside the runner (
lando composer audit,lando drush pm:security,lando npm audit) — the bootstrapped, network-capable environment. Best signal. Start Docker/Lando if it isn't up (lando start). - On the host — if the runner is down (Docker not running,
lando startfails), runcomposer audit --locked/npm auditdirectly on the host. The host PHP version may differ, but--lockedaudits the committed lockfile so the result is still valid. - Offline fallback via
WebFetch— if the environment has no network from the shell (sandboxedcomposer audit/npm auditfail with curl errors), DON'T give up and DON'T claim "0 vulnerabilities". Extract installed versions from the lockfile (see below), then pull the advisory feeds withWebFetch(a separate network path that often works when the shell is sandboxed) and cross-reference by hand. See the Drupal and offline sections.
The goal is to get real material one way or another. A "couldn't run anything" report is a last resort, not a first answer — exhaust runner → host → WebFetch before concluding.
PHP / Composer
First, extract the exact installed versions from the lockfile (works with zero network, host or runner):
# Drupal core version
php -r '$l=json_decode(file_get_contents("composer.lock"),true);
foreach(array_merge($l["packages"]??[],$l["packages-dev"]??[]) as $p)
if($p["name"]==="drupal/core") echo $p["version"],"\n";'
# All drupal contrib + versions + abandoned/pre-release flags
php -r '$l=json_decode(file_get_contents("composer.lock"),true);
foreach(($l["packages"]??[]) as $p){
if(preg_match("#^drupal/(?!core)#",$p["name"])){
$ab=!empty($p["abandoned"])?" [ABANDONED]":"";
$pre=preg_match("#(alpha|beta|-rc|dev-)#i",$p["version"])?" [pre-release]":"";
echo str_pad($p["name"],45)." ".$p["version"].$ab.$pre."\n";
}
}'
Then run the real audit:
composer audit --locked --format=plain # audits composer.lock against the PHP advisories DB
composer audit --locked --format=json # machine-readable, for parsing severity/CVE/affected versions
--locked audits what is actually committed (composer.lock), not just the resolved tree. Each advisory carries a CVE/GHSA id, affected version range, and a link — keep these for the report.
Drupal (core + contrib)
composer audit covers Drupal core and contrib that publish to the advisory DB, but confirm with Drupal's own tooling when a bootstrapped site is available:
drush pm:security # core + contrib modules with an open security advisory (SA-*)
drush pm:security-php # PHP-library advisories affecting the codebase
drush status --field=drupal-version # is core itself within a supported / patched release?
- Check drupal/core version against the latest security release — an EOL minor (e.g. a 9.x past EOL) is itself a finding regardless of named CVEs.
- For contrib, map each advisory to its SA-CONTRIB-YYYY-NNN and the fixed version.
- Flag any module that is unsupported / abandoned (no security coverage) — that's a standing risk, not a one-off CVE.
- If drush isn't available (no bootstrapped site), say so and rely on
composer audit+ the Drupal version check; don't claim the contrib advisory pass ran.
Important — Drupal advisories are NOT on packagist.org. drupal/* modules are hosted on packages.drupal.org, and their SAs live on Drupal.org, not in packagist's security API. So a packagist-only query (or a generic tool that only knows packagist) will return empty for Drupal contrib and give a false "all clear". composer audit knows the Drupal endpoint; a manual cross-check must use the Drupal.org advisory feeds.
Offline fallback — cross-reference via the Drupal.org advisory feeds (WebFetch)
When composer audit / drush pm:security can't run (no shell network, no bootstrap), fetch the official Drupal advisory feeds with WebFetch and cross-reference each against the versions you extracted from composer.lock:
WebFetch https://www.drupal.org/security/rss.xml → core SAs (SA-CORE-YYYY-NNN) + fixed versions
WebFetch https://www.drupal.org/security/contrib/rss.xml → contrib SAs (SA-CONTRIB-YYYY-NNN) + fixed versions
WebFetch https://www.drupal.org/security/psa/rss.xml → public service announcements
For each installed module, compare installed version vs the advisory's Fixed in version: installed < fixed ⇒ vulnerable. Drupal.org may print legacy tags like 8.x-3.15 — that maps to composer version 3.15. The RSS feeds only carry the most recent ~25 advisories per feed, so older SAs affecting your modules may not appear — say so explicitly and recommend a live composer audit to be exhaustive. Don't claim full contrib coverage from RSS alone; do claim the matches you actually found (they're from the authoritative source).
JavaScript
Use the runner that matches the lockfile:
npm audit --omit=dev # or: npm audit --json
pnpm audit --prod # or: pnpm audit --json
yarn npm audit --environment production # yarn berry
Separate prod from dev dependencies — a high-severity CVE in a build-only devDependency is a far lower real risk than the same in shipped runtime code. Note which side each finding is on. For a Drupal theme/asset pipeline (gulp/webpack/postcss/sass compiled to static CSS/JS), the entire npm tree is effectively build-time — flag those findings as Low real risk and say why, but still run the audit.
If npm audit can't reach the network, read package.json + package-lock.json for the installed versions and cross-reference notable packages against the GitHub Advisory Database (WebFetch https://github.com/advisories?query=<package>) rather than skipping the JS side entirely.
Docker configuration
If a Dockerfile / compose file exists, audit the configuration (this overlaps /clara:docker-devops — reuse its hardening checklist rather than re-deriving it). Check for:
- Base image: floating tags (
:latest, unpinned), or a base that is itself EOL / vulnerable. - Privilege: container running as
root(noUSER),privileged: true, added capabilities,--privileged. - Docker socket:
/var/run/docker.sockbind-mounted into a container (container-escape surface). - Secrets: credentials in
ENV/ARG, hardcoded in compose, or copied into image layers;.envcommitted. - Exposed surface: ports bound to
0.0.0.0that should be internal; admin/DB ports published needlessly. - Filesystem: no
read_only, writable mounts that needn't be, host paths mounted broadly. - Image scan (if a scanner is available):
docker scout cves <image>ortrivy image <image>/trivy config .— report OS/library CVEs in the built image. If no scanner is installed, say so; don't fabricate results.
Prioritise by criticality
Rank every finding — advisory counts are noise, exploitable findings are signal. Tag each with one level, judged in context, not by the raw CVSS alone:
- Critical — remotely exploitable on shipped/runtime code, RCE, auth bypass, exposed secret, container escape. Fix now.
- High — serious vuln on a reachable runtime path, or a privilege/secret issue gated by some condition.
- Medium — real but constrained: needs auth, hard-to-reach path, or limited to a prod-but-low-exposure surface.
- Low — dev-only dependency, theoretical, or requires already-elevated access.
- Info — hygiene (unsupported module, unpinned base image, EOL minor) with no named CVE yet.
Context that moves a finding up or down: prod vs dev dependency; runtime-reachable vs build-only; internet-facing vs internal; whether a fixed version actually exists yet; whether the vulnerable code path is even used. Say why you placed each finding where you did when it differs from the advisory's nominal severity.
Remediate
For each finding, give one of two things — never a vague "update your dependencies":
A. Propose the fix (when it's safe and mechanical):
composer update drupal/core-recommended --with-dependencies # to the patched release
composer require drupal/<module>:^X.Y # bump contrib to the fixed version
npm audit fix # non-breaking, when it resolves the advisory
Offer to apply these to the working tree when the user wants. After applying, re-run the audit to confirm the finding clears and nothing else broke (build/tests if quick).
B. Give the marche à suivre (when the fix is breaking, risky, or has no clean version yet):
- A major version bump with BC breaks → outline the migration steps, what to test, what likely breaks.
- No patched release exists → the mitigation (config workaround, WAF rule, disable the feature, pin + watch the advisory), plus what to monitor.
- A Drupal core update that needs
update.php/ config sync → the ordered steps, with the DB-backup-first reminder. - An abandoned/unsupported module → replace, fork-and-patch, or remove — with the trade-offs.
Be explicit about breaking-change risk: don't propose a blind composer update that drags the whole tree forward. Scope every bump to the affected package(s) and their needed deps.
Output format
Lead with a one-line headline: counts by severity and the single most urgent action. Then:
Summary table — one row per ecosystem audited:
| Ecosystem | Audited | Critical | High | Medium | Low | Info |
|---|---|---|---|---|---|---|
| Composer (Drupal) | ✅ | … | … | … | … | … |
| npm (prod) | ✅ | … | … | … | … | … |
| Docker config | ✅ | … | … | … | … | … |
Then findings, most critical first. Full block for Critical/High, one line for Medium/Low, fold Info into a trailing line:
- [Critical] <package/component> — <vuln> (CVE/GHSA/SA-id)
Affected: <version range> · Installed: <current> · Fixed in: <version | none yet>
Risk here: <why this severity in THIS project — reachable? prod? exposed?>
Fix: <exact command, or numbered marche à suivre if breaking>
- [Medium] <component> — <vuln> (<id>) → <one-line remediation>
Info: <unsupported module X>; <unpinned base image Y>; <EOL core minor Z>
Close with what couldn't be verified — and be specific about which rung of the runner → host → WebFetch chain you reached and what's still pending (e.g. "RSS cross-check done, but a live composer audit for the full contrib history is still owed"). When there are fixes to ship, point the user at /clara:review → /clara:merge-request to land them.
Non-goals
- Not an offensive / pentest tool. No exploitation, no payloads, no live-target probing — codebase and dependency audit only.
- Don't report raw advisory dumps — rank, dedupe, and contextualise. A wall of
npm auditoutput is the input, not the deliverable. - Don't claim a check passed unless it actually ran; mark unavailable tools "(indispo)".
- Don't blind-bump the whole dependency tree to silence one advisory. Scope every change.
- Don't flag app-level code bugs here (injection, XSS in custom code) — that's
/clara:review's job; note them as out-of-scope if you spot them.