Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,860 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dev-guardian

English · Português (pt-PT) · Español

An open-source security, bug-finding, code-quality, dependency, compliance, observability and performance toolkit for Claude Code and Cowork — and, through its MCP server, for any MCP-capable AI host. It drives open-source scanners (Semgrep, Trivy, gitleaks, Syft, …), keeps every result in a local SQLite database so baselines, deltas and suppressions survive between sessions, and says so when a scanner did not run instead of reporting "0 findings". It also vets third-party AI skills and MCP servers, and the packages an agent is about to install, before they reach your machine.

Trilingual: the skills and commands answer in English, Portuguese or Spanish, whichever you write in.

What's inside

  • 13 skills and 10 slash commands for Claude Code / Cowork (below).
  • An MCP server with 50 tools and 18 resources, TypeScript on node:sqlite, committed pre-built — full reference in docs/tools.md. The 13 tool names that 3.3.0 folded into dotnet_check, wp_audit, wp_vuln_check, wp_report, diff_scans and prioritize_findings, and the three LLM-scan steps 3.4.0 folded into llm_scan, still answer calls; they are no longer listed.
  • 182 Semgrep rules in 15 packs written for this project: bug classes for seven languages, an RGPD/GDPR pack, a route-inventory pack for nine languages, a Node/Express pack (SQL built by interpolation, request path to a file API, request URL fetched), a client-trust pack (a secret behind a browser-exposed env prefix such as NEXT_PUBLIC_ or VITE_, the Supabase service-role key in browser code, a payment webhook that never verifies its signature or verifies a parsed body), a mobile pack (a debuggable or backup-enabled Android app, cleartext traffic, exported components without a permission, user-installed CAs trusted, iOS App Transport Security switched off, and in Java and Kotlin WebView debugging, trust-all TLS and world-readable files), a WordPress pack (an esc_sql value put outside quotes in SQL, the shape of CVE-2021-24340) and an LLM-application pack (model output reaching eval/shell/SQL, remote code in a model load, prompt injection surface, no token cap) that scan_sast runs — see docs/rule-packs.md.
  • Client-trust and test-integrity checks beside the scanners: scan_sast reads every .env* file — the ones git ignores too, never printing a value — for a secret behind a browser prefix, and the Supabase migrations for tables without row-level security or write policies open to anyone; review_pr (and a diff-scoped scan_sast, and scan --diff-base in CI) reports the tests a change weakened — a focused .only, an added skip, a deleted test file, fewer assertions, a test script made to always pass.
  • Guardrail hooks that deny catastrophic shell commands, vet packages at install time and warn on secrets as they are written — see docs/hooks.md.
  • A CLI (cli/dev-guardian.mjs) for CI gating, host setup, a terminal status view and an HTML dashboard.

Requirements

  • Node.js ≥ 22.13. The database is Node's built-in node:sqlite, used without any flag. On an older Node the server exits with dev-guardian requires Node.js >= 22.13 (node:sqlite).
  • git.
  • Claude Code 2.1.139 or later, for the guardrail hooks. hooks/hooks.json runs them in exec form ("command": "node", the dispatcher in "args"). An older Claude Code does not pass "args", so no hook starts — and a hook that never starts cannot tell you so. The MCP tools and the CLI do not depend on it.
  • The scanners you want to use, installed separately. check_toolchain reports what is present (and flags the compromised Trivy 0.69.4–0.69.6); install_toolchain or /guardian-init installs the rest. A scanner that is missing is reported as a coverage gap, never as a clean result.
  • Installed is not detecting. node cli/dev-guardian.mjs selftest seeds a temporary project with one known defect per core control — each of dev-guardian's own Semgrep packs, gitleaks, Trivy's dependency audit and IaC scan, the guardrail hooks — and says which of them are found on this machine: detected, silent (it read the canary and reported nothing: 0 findings from it prove nothing here), missing or unverified. health_status and check_toolchain show the last result. See docs/selftest.md.
  • Optional: Docker. Without a native semgrep, scan_sast and map_attack_surface fall back to the semgrep/semgrep image.
  • Windows: every scan runs natively, with no shell. A bash is needed only for init_project's first-pass status report and for install_toolchain's WSL fallback when none of winget, scoop or choco is present. dev-guardian looks for Git Bash first, then WSL, then any bash on PATH.

Nothing needs npm install: the MCP server and the CLI run on mcp/dist/engine.js, and the hooks on mcp/dist/hooks.js, committed as self-contained bundles.

Quick start (Claude Code)

/plugin marketplace add https://github.com/linofcp007/dev-guardian
/plugin install dev-guardian@dev-guardian

Then, in your project:

/guardian-init        detect the stack, install scanners, write configs and pre-commit hooks
/guardian-scan        full security scan (or --staged, --branch, --since …)
/guardian-status      one-screen health view

From a local clone instead: claude --plugin-dir /path/to/dev-guardian for one session, or /plugin marketplace add /path/to/dev-guardian to install it. Every skill also fires on plain language — "audit the project", "is this safe to ship?", "vê se há vulnerabilidades", "¿hay agujeros de seguridad?".

Slash commands

Command Modes What it does
/guardian-scan none, --staged, --uncommitted, --unpushed, --branch [base], --since <ref>, --incoming, paths Security scan of the whole project, or only of what changed
/guardian-fix hint, fingerprint, --pr [--apply], --verify Find and fix bugs, open verified fix PRs, prove a fix with a re-scan
/guardian-report exec, handoff, trend, debt, changelog, soc2 Reports from the scan history
/guardian-incident panic, leak, rollback, postmortem Incident response
/guardian-release predeploy, prerelease Go / no-go gates
/guardian-status optional focus (e.g. "only security") Latest scan, deltas, baseline, expiring suppressions
/guardian-infra docker, iac Dockerfile, image, compose, Terraform, Kubernetes, CloudFormation, Helm
/guardian-wp install path or site URL WordPress audit
/guardian-dotnet project or solution path C# / .NET audit
/g what you want checked Alias of the guardian router skill

Version 2.0.0 had 48 of them; CHANGELOG.md maps every old name to its replacement.

Skills

Skill For
/guardian Router: picks the right command or skill
/guardian-security SAST, secrets, dependency CVEs, IaC, DAST and reachability, with triage
/guardian-bugfix Implementation bugs, found and fixed methodically
/guardian-init First run in a project: toolchain, configs, pre-commit
/guardian-review Senior-style review before a PR, merge or deploy
/guardian-deps CVE audit, upgrade plan and PRs, install vetting, VEX
/guardian-quality Duplication, complexity, tech debt, .guardian/budgets.yml
/guardian-compliance RGPD/GDPR, licences, SBOM, audit evidence, cookie banner and privacy policy templates
/guardian-observability Structured logging and metrics
/guardian-performance Lighthouse, k6, performance budgets
/guardian-grill Grills you on a diff's decisions before merge
/guardian-improve Turns measured tech debt into improvement specs
/guardian-scanskill Vets a third-party skill, MCP server or agent before install

The MCP server

Area Tools
Security scans security_scan_full, scan_sast, scan_secrets, scan_deps, scan_containers, scan_iac, review_pr
Bugs and quality bug_hunt, quality_check, suggest_fix, create_fix_pr
Dependencies and supply chain deps_audit, deps_update_plan, vet_packages, generate_sbom, sbom_diff, export_vex, license_compatibility, scan_skill, audit_agent_config, audit_mcp_tools
Attack surface map_attack_surface, scan_dast, validate_finding
LLM-assisted scan llm_scan (step: start, task, submit) — your host's model verifies the findings and hunts what scanners miss; the server calls no model (docs/llm-scan.md)
History and triage diff_scans, set_baseline, suppress_finding, risk_score, prioritize_findings, health_status, import_sarif
Reports audit_executive, report_export, compliance_check, compliance_evidence, create_github_issues
Setup and ops detect_stack, check_toolchain, install_toolchain, init_project, precommit_install, register_custom_rules, observability_setup, perf_check
WordPress scan_wordpress, wp_audit, wp_vuln_check, wp_report
C# / .NET dotnet_check

Resources (guardian://scans/latest, guardian://findings/open, guardian://cves/active, guardian://surface/latest, …) serve the stored results as JSON. Everything persists in .guardian/guardian.db; the server keeps .guardian/ out of git except .guardian/baseline.json, which CI needs committed. History, suppressions and baselines are keyed by the project's path: moving or renaming the repository starts them afresh (the old rows stay under the old path). A guardian.db your dev-guardian did not create (one that came with a clone or an archive, or that git tracks) is never opened. Upgrading from 3.0.0: your existing guardian.db is not trusted automatically either — until you register it, scans go to a per-user fallback and health_status says so. If it is yours, run node <plugin>/cli/dev-guardian.mjs db adopt --project . --yes once, yourself (without --yes it first shows what it holds; --rehome also moves scans recorded under a link to the project). See SECURITY.md.

What each stack gets

Stack Detected Bug rules (bug_hunt) Routes (map_attack_surface) Dependency CVEs Reachability (validate_finding)
JavaScript / TypeScript yes 13 rules Express, NestJS Trivy, npm audit reachable / unreachable
Python yes 10 rules Flask, FastAPI, Django Trivy, pip-audit reachable / unreachable
Go yes 9 rules net/http, gin, chi Trivy reachable / unreachable
Rust yes 1 rule (blocking sleep in async fn) actix-web Trivy reachable / unreachable
Java yes 7 rules Spring Trivy (Maven; Gradle only with a gradle.lockfile) reachable / unknown only
C# / .NET yes 11 rules ASP.NET Core Trivy, dotnet list package --vulnerable reachable / unknown only
PHP yes, also without composer.json 6 rules Laravel Trivy (composer.lock) reachable / unknown only
WordPress yes, with WooCommerce and Kadence the PHP rules, plus p/wordpress in scan_wordpress REST routes WPScan (live URL), Wordfence feed (from source) as PHP
Ruby yes none (RuboCop runs in quality_check) Rails-style routes Trivy (Gemfile.lock) reachable / unknown only
Kotlin yes none (detekt runs in quality_check) — Trivy (Gradle only with a gradle.lockfile) —

Beyond the table, scan_sast runs Semgrep's registry ruleset (--config=auto), which picks rules for whatever languages it finds — Kotlin included — plus Bandit for Python and gosec for Go (through the Go toolchain, which may download the project's modules) and cppcheck for C and C++ (2.13 or newer; a compile_commands.json is used when the project has one), plus Psalm's taint analysis for PHP (scan_wordpress too, with WordPress's $wpdb queries as SQL sinks and its escapes as safe) and SpotBugs with FindSecBugs over compiled Java and Kotlin (the classes a build left — scan_sast never builds the project; with none it says so, and it is no gap), and gitleaks scans every project for secrets. deps_audit adds govulncheck for Go — the vulnerable functions the code actually calls — and quality_check adds shellcheck for shell scripts, detekt for Kotlin and RuboCop for Ruby (with dev-guardian's own configuration: a .rubocop.yml's require runs code). A Rails project can bring Brakeman's own SARIF into the same history with import_sarif (docs/sarif-import.md). Containers and IaC (Dockerfile, images, compose, Terraform, Kubernetes, CloudFormation, Helm, GitHub Actions workflows) are covered by scan_containers and scan_iac; for an image, scan_containers also uses cosign to check whether it is signed and has signed SLSA provenance, and verifies the signer when you name one. "Reachable / unknown only" means the tool never claims code is unreachable in a language that resolves code at runtime (autoload, annotations, DI containers). dotnet_check runs four .NET checks (secrets, target framework, EF Core migrations, setup), and the four WordPress tools ten modes between them. Trivy reads a Gradle lock file for any project, Kotlin included, and a Gradle build it could not read is a named coverage gap; no bug_hunt rule or route extractor exists for Kotlin.

Gradle and Python need a lock file for Trivy. Trivy reads Gradle dependencies only from gradle.lockfile, and Python ones only from poetry.lock, uv.lock, Pipfile.lock or a pinned requirements.txt. A build.gradle / build.gradle.kts, pyproject.toml, setup.py / setup.cfg, Pipfile or requirements*.txt it could not read is reported as a coverage gap (trivy:gradle, trivy:python, or trivy skipped when it read nothing else), never as a clean scan. That holds for a manifest anywhere in the tree — a web/package.json beside a root lock file included; only a workspace member is covered by its root's lock — and for a go.mod Trivy could not parse (trivy:go). Generate the lock file to close it. For Gradle, first enable dependencyLocking { lockAllConfigurations() } in the build — without it gradle dependencies --write-locks writes nothing — then run that command. For Python, run poetry lock, uv lock or pipenv lock, or pin every dependency in requirements.txt.

Guardrail hooks

Loaded automatically with the plugin, dependency-free and fail-open:

  • SessionStart — a short security-posture briefing.
  • PostToolUse on writes — warns, with a redacted preview, when a secret is written.
  • PreToolUse on Bash and PowerShell — denies catastrophic commands (rm -rf /, curl … | sh, iwr … | iex, raw-disk writes, fork bombs), warns on risky ones, and vets packages before npm, pnpm, yarn, bun, pip, uv, poetry, composer or dotnet add package installs them: a malicious package is denied, a nonexistent one is denied only in a plain, single install command.
  • PreToolUse on writes — denies an assistant's edit of the hook configuration itself; optionally blocks writing a provider token.

A project's .guardian/hooks.config.json cannot switch a protective hook off: only its advisory settings (secrets.warn, sessionStart, ignorePaths) and stricter ones take effect. Switching one off takes the user-level config or an environment variable.

Details, configuration and the escape hatches: docs/hooks.md. The same detectors run from a terminal with node cli/dev-guardian.mjs check --file <path> or --bash "<command>".

Other AI hosts

Cursor, Windsurf, GitHub Copilot, Codex CLI, Gemini CLI and Cline get the MCP server and a rules file, Claude Desktop the MCP server alone (no skills, commands or hooks). Clone once, then run the CLI by its absolute path from your project:

git clone --depth 1 --branch v3.16.1 https://github.com/linofcp007/dev-guardian.git ~/tools/dev-guardian
node ~/tools/dev-guardian/cli/dev-guardian.mjs mcp-config cursor --write
node ~/tools/dev-guardian/cli/dev-guardian.mjs mcp-config all --write --update-mcp

The clone above pins 3.16.1; to follow a later release, clone its vX.Y.Z tag instead. --update-mcp, --global and ci-init need 3.0.0 or later — 2.0.0 also writes the global Windsurf and Claude Desktop configs on mcp-config all --write. The CLI fills in absolute paths, merges instead of overwriting, and manages only a delimited block inside AGENTS.md-style files; --update-mcp refreshes an entry that is out of date. Per-host paths and manual snippets: docs/hosts.md.

CI

node ~/tools/dev-guardian/cli/dev-guardian.mjs ci-init github --write                # also gitlab, bitbucket
node ~/tools/dev-guardian/cli/dev-guardian.mjs baseline update --project .           # commit .guardian/baseline.json
node ~/tools/dev-guardian/cli/dev-guardian.mjs scan --project . --fail-on high --sarif results.sarif

ci-init generates a pipeline with every action pinned by commit SHA and every scanner by version and checksum. scan exits 0 on a pass, 1 when a finding new to the baseline reaches --fail-on, 2 when a scanner did not run (never read that as a pass) and 3 on a usage error. On a pull request the generated pipeline gates against the base commit's baseline and Semgrep rules (--baseline-ref, --rules-ref), never the pull request's own. See docs/ci.md. Run these from your project, with the path of your clone (the plugin's own copy works too). For a local view: status and dashboard (a self-contained HTML page, no network). To bring another scanner's SARIF log into the same history, use the import_sarif tool or import-sarif <file> — see docs/sarif-import.md.

With dev-spec-driven (1.29+). Its /spec-finish can run this gate as a project check (spec_init { guardian: true } in a session, or node "<dev-spec-driven plugin>/cli/dev-spec.js" init --guardian in a terminal): only a finding new to the baseline, at high or above, blocks the finish, and exit 2 is an incomplete scan, never a pass. Record the baseline on the base branch before you turn the check on. Accept one finding you have reviewed with a suppression its scanner reads (nosemgrep: <rule> -- <reason>, .trivyignore, .gitleaksignore), never with baseline update — it accepts every current finding, the feature's own included — and never by forcing the finish; see docs/ci.md.

Privacy and network

dev-guardian sends no telemetry of its own. Some tools do reach the network — Semgrep's registry mode (which sends usage metrics to Semgrep Inc.; local_only: true avoids it), Trivy's database, a .NET project's NuGet feeds (scan_sast restores and builds it, local_only or not), OSV, package registries, CISA KEV / FIRST EPSS, Wordfence, and opt-in live secret verification. The complete list, per tool, is in SECURITY.md. GUARDIAN_OFFLINE=1 switches off the lookups dev-guardian makes on its own (threat intelligence, package vetting, live secret verification, the Wordfence feed); every environment variable is in docs/env.md.

Troubleshooting

The MCP server does not connect. /mcp in Claude Code shows the server's state. Claude Code logs each server's stderr under its cache directory: %LOCALAPPDATA%\claude-cli-nodejs\Cache\<project>\mcp-logs-<server>\ on Windows (the plugin's is mcp-logs-plugin-dev-guardian-dev-guardian), and — by the same convention, not verified here — ~/.cache/claude-cli-nodejs/… on Linux and ~/Library/Caches/claude-cli-nodejs/… on macOS. The usual causes:

  • Node older than 22.13 (see Requirements).
  • A project .mcp.json that uses ${CLAUDE_PROJECT_DIR}: Claude Code does not expand it there, so node receives the literal string. Use a relative path; project servers start in the project root.

no_bash_shell. Only install_toolchain's default install on Linux and macOS needs bash, plus init_project's status report. On Windows, install Git for Windows. From PowerShell, bash may resolve to the WSL launcher stub rather than Git Bash; dev-guardian probes Git Bash first on its own, but a command you type yourself may not.

Coverage none or partial, or scan exits 2. A scanner was missing, failed, or scanned nothing. tools_run and missing_tools in the response name it; check_toolchain shows what is installed. Fix that and re-run — a scan with a gap is never served from the cache.

install_toolchain with elevation_allowed: true fails with "sudo: a terminal is required to read the password". Install steps run detached, with no terminal, so on Linux and macOS elevation only works with passwordless sudo for those commands. Otherwise run the commands listed under requires_elevation yourself. The .NET SDK is never installed automatically.

Semgrep sends metrics. The default scan_sast uses --config=auto, which Semgrep only allows with metrics on. Pass local_only: true (or --local-only on the CLI) to keep Semgrep local: only rules on disk — the project's own and the plugin's packs (the LLM-application pack still runs) — with --metrics=off and no registry download. It is not "nothing leaves the machine": Trivy still fetches its vulnerability database and a .NET project is still restored from its NuGet feeds (SECURITY.md). Semgrep's own version check is off on every run.

Repository layout

.claude-plugin/   plugin.json + marketplace.json
commands/         the 10 slash commands
skills/           the 13 skills
hooks/            hooks.json + guardian-hook.mjs
cli/              dev-guardian.mjs (mcp-config, check, scan, baseline, ci-init, status, dashboard, db adopt, import-sarif, selftest)
mcp/              the MCP server: src/, test/, dist/ (committed)
configs/          Semgrep packs, CI templates, gitleaks/Renovate/pre-commit configs, compliance templates
host-rules/       rules templates for other hosts
docs/             tools, rule packs, hooks, CI, hosts, environment
scripts/          install/install-linux.sh, install/install-macos.sh, scan/initial-scan.sh

Contributing: CONTRIBUTING.md and CLAUDE.md. Security reports: SECURITY.md.

License

MIT. Carlos Pereira · prodigitalkey.com

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages