vinceamstoutz / symfony-security-auditor
AI-powered multi-agent security auditor for Symfony applications — provider-agnostic via symfony/ai
Package info
github.com/vinceAmstoutz/symfony-security-auditor
Type:symfony-bundle
pkg:composer/vinceamstoutz/symfony-security-auditor
Requires
- php: >=8.3
- composer-runtime-api: ^2.0
- league/uri-polyfill: ^7.8
- mcp/sdk: ^0.10.0
- nikic/php-parser: ^5.3
- psr/clock: ^1.0
- psr/log: ^3.0
- symfony/ai-bundle: ^0.15
- symfony/clock: ^7.4 || ^8.0
- symfony/config: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/deprecation-contracts: ^2.5 || ^3
- symfony/filesystem: ^7.4 || ^8.0
- symfony/finder: ^7.4 || ^8.0
- symfony/http-client: ^7.4 || ^8.0
- symfony/models-dev: >=130.0
- symfony/process: ^7.4 || ^8.0
- symfony/string: ^7.4 || ^8.0
- symfony/validator: ^7.4 || ^8.0
- symfony/yaml: ^7.4 || ^8.0
Requires (Dev)
- deptrac/deptrac: ^4.6
- ergebnis/composer-normalize: ^2.52
- ergebnis/phpunit-agent-reporter: ^1.0
- ergebnis/phpunit-slow-test-detector: ^2.24
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/extension-installer: ^1.4
- phpstan/phpdoc-parser: ~2.4.0
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^12.5 || ^13.4
- rector/rector: ^2.4
- rector/swiss-knife: ^2.4
- spaze/phpstan-disallowed-calls: ^4.12
- staabm/phpstan-todo-by: ^0.3
- symfony/ai-anthropic-platform: ^0.15
- symfony/ai-claude-code-platform: ^0.15
- symfony/ai-codex-platform: ^0.15
- symfony/ai-gemini-platform: ^0.15
- symfony/ai-open-ai-platform: ^0.15
- symfony/dotenv: ^7.4 || ^8.0
- symfony/error-handler: ^7.4 || ^8.0
- symfony/var-dumper: ^7.4 || ^8.0
- symplify/phpstan-rules: ^14.10
- tomasvotruba/cognitive-complexity: ^1.0
Suggests
- symfony/ai-albert-platform: To run the audit against the Albert platform (needs a base_url)
- symfony/ai-amazee-ai-platform: To run the audit against amazee.ai (needs a base_url)
- symfony/ai-anthropic-platform: Anthropic (Claude) platform bridge — claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5
- symfony/ai-azure-platform: Azure OpenAI platform bridge — enterprise GPT-5.6, gpt-5.4-mini
- symfony/ai-bedrock-platform: AWS Bedrock platform bridge — Claude, Nova, Llama on AWS
- symfony/ai-deep-seek-platform: DeepSeek platform bridge — deepseek-flash, deepseek-v4-pro
- symfony/ai-eden-ai-platform: Eden AI platform bridge — OpenAI-compatible gateway over many providers
- symfony/ai-fireworks-platform: Fireworks AI platform bridge — hosted open-weight models
- symfony/ai-gemini-platform: Google Gemini platform bridge — gemini-3.1-pro-preview, gemini-3.6-flash
- symfony/ai-generic-platform: Generic OpenAI-compatible platform bridge for any AI gateway or self-hosted endpoint exposing a custom base_url plus token (LiteLLM, vLLM, LocalAI, …)
- symfony/ai-mini-max-platform: MiniMax platform bridge — MiniMax-M3, MiniMax-M2.7
- symfony/ai-mistral-platform: Mistral platform bridge — mistral-large-latest, codestral-latest
- symfony/ai-ollama-platform: Ollama local inference bridge — llama3.3, deepseek-r1, qwen3, phi4 (no API key)
- symfony/ai-open-ai-platform: OpenAI platform bridge — gpt-5.6, gpt-4.1
- symfony/ai-open-responses-platform: OpenAI Responses API platform bridge
- symfony/ai-together-platform: Together AI platform bridge — hosted open-weight models
- symfony/ai-venice-platform: Venice AI platform bridge — private inference
- symfony/ai-vertex-ai-platform: Google Vertex AI platform bridge — Gemini + Claude on GCP
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-28 22:02:24 UTC
README
AI-powered, multi-agent security auditor for Symfony applications. An adversarial Attacker ⚔ Reviewer loop catches the application-level flaws SAST tools miss. Provider-agnostic via symfony/ai.
Note
main holds exactly the latest release, so everything documented here is in the version you install. Development happens on version branches.
Why this auditor?
Traditional PHP static analysis tools (PHPStan, Psalm) catch type errors. Static SAST tools (Psalm Security, Progpilot) follow taint flows but cannot reason about business logic, missing authorization, or multi-file attack chains. Dependency scanners (Dependabot, Renovate, Snyk) only flag known CVEs in third-party packages. This auditor runs alongside them, targeting the application-level logic flaws they cannot see.
Side-by-side comparison with PHPStan, Psalm, Progpilot, Dependabot and Snyk: FAQ.
What it does
An adversarial Attacker agent hunts for vulnerabilities; a skeptical Reviewer agent culls false positives over up to three iterations, then emits a validated report in console, JSON, SARIF, HTML, or Markdown.
🔀 Pipeline: Ingestion → Mapping → Audit (Attacker ⚔ Reviewer) → Report.
See it in action
Live audit
While the pipeline runs, the audit narrates itself live: an attack-surface overview, each finding streamed (color-coded by severity in a terminal) the moment the Attacker flags it, per-chunk timing and a reviewer tally. In CI or any non-TTY output it degrades to clean, append-only lines (no bar, no ANSI codes). Progress is suppressed for any non-console --format to stdout and for --dry-run.
The full report renders the same way in console, JSON, SARIF, HTML and Markdown: see CLI reference and output formats.
Cost estimate with --dry-run
Scans files and estimates token usage and cost without calling the LLM. Use this to gauge cost before committing to a full audit.
bin/console audit:run --dry-run
No LLM calls are made; the exit code is 0 unless the command is refused before the estimate (an invalid option or project path, or a --path outside the project), which exits 1.
Getting Started
The auditor ships two maintained ways to run it. Pick the one that fits:
- Standalone CLI (recommended): one download, configured once, audits any project with zero footprint in it. Best for most users and for auditing a project you don't want to add a dependency to.
- Symfony bundle: wired into a Symfony app via Flex. Pick this to extend the auditor (custom services, decorated ports) or to pin it in the app's
devdependencies.
Tip
Both expose the same audit command, options and output formats (see the CLI reference) and both can serve the auditor to your AI assistant over MCP (experimental). To move an existing setup from one to the other, follow Switching Between the Standalone Binary and the Bundle.
Standalone tool (binary)
One install, many projects, zero footprint in the audited app. Each release ships a self-contained native binary with its own PHP runtime for Linux, macOS and Windows.
Requirements
Nothing but the binary and access to a model: an API key, a Claude or ChatGPT subscription through its CLI, or a local model such as Ollama. No PHP or Composer: the one-time init fetches the provider bridge with the Composer the binary bundles. --since needs git. Live CVE lookups run composer audit with that bundled Composer too.
1. Install
# Linux, macOS, Windows under WSL curl -fsSL https://raw.githubusercontent.com/vinceAmstoutz/symfony-security-auditor/main/install.sh | sh
# Native Windows (PowerShell, Git Bash, MSYS, Cygwin) irm https://raw.githubusercontent.com/vinceAmstoutz/symfony-security-auditor/main/install.ps1 | iex
Both detect your OS and CPU, download the matching binary and abort rather than install one whose SHA-256 checksum they cannot verify. You can also download an asset from the latest release and check it with its .sha256 file.
Tip
Set SSA_INIT=1 on either command and the installer runs the guided init right after downloading ($env:SSA_INIT = '1' in PowerShell). With a terminal it prompts for your provider and API key; in a pipe or CI it takes the Anthropic defaults and stores no key.
2. Configure: the guided init
symfony-security-auditor init
init asks how you access AI models (subscription, API key, local model, gateway or cloud account), lists the matching providers and models with their price, installs the provider bridge and takes your API key invisibly. Press Enter to skip it and run auth:set later, or keep using an environment variable. It writes ~/.config/symfony-security-auditor/config.yaml (%APPDATA%\symfony-security-auditor\config.yaml on Windows), which takes the bundle's keys without the symfony_security_auditor: wrapper plus a platform: block. See configuration. It can end by sending one test request (doctor --check-connection).
Check the setup at any time with doctor, before you spend a token: configuration and API key, provider bridge, Composer and pricing catalog. It exits 1 when a check fails, so it drops into a CI preflight step. See doctor.
symfony-security-auditor doctor
3. Run
symfony-security-auditor audit /path/to/your/symfony/project
audit is an alias for audit:run; every option of the CLI reference (--format, --output, --dry-run, --since, --fail-on, …) works identically. Every run names the key it is about to spend, masked (API key: sk-ant…qF4A).
Managing the stored key
| Command | What it does |
|---|---|
auth:set |
Store or replace the key: prompts invisibly, writes an owner-only file |
auth:status |
Show which key an audit would use, where it came from and its SHA-256 fingerprint (never the key) |
auth:test |
Send one short test request to check the provider answers |
auth:remove |
Forget the stored key on this machine |
The key lives in an owner-only credentials.json next to your config, which an audit refuses to read if other users can. An exported variable always wins, so Docker, Kubernetes and CI are unchanged: ANTHROPIC_API_KEY=$(pass show anthropic/api-key) symfony-security-auditor audit .. Storing nothing is fine too: Providing the API key covers environment variables, mounted secret files, password managers and CI secrets.
4. Keep it up to date
symfony-security-auditor self-update # download + verify + replace, if newer symfony-security-auditor self-update --check # only report whether a newer version exists
self-update verifies the checksum before replacing the binary. See the CLI reference. self-update --snapshot (or SSA_VERSION=snapshot with the installers) installs the pre-release built from every push to the development branch; a plain self-update returns to the latest release.
5. Shell completion (optional)
symfony-security-auditor completion bash|zsh|fish prints a script that makes Tab complete commands, options and arguments. Shell completion shows where each shell loads it from. You write it once: it keeps working after a self-update.
Use it as a Symfony bundle
1. Install: Symfony Flex wires everything
Installing the bundle requires PHP 8.3+ and Symfony 7.4+ in the host application (see composer.json).
composer require --dev vinceamstoutz/symfony-security-auditor
The official Flex recipe registers the bundle (dev/test) and drops a pre-configured config/packages/symfony_security_auditor.yaml.
Not using Flex? See Manual setup.
2. Install a platform bridge
# Anthropic shown
composer require symfony/ai-anthropic-platform
Full list of supported providers: Configuration → Supported platforms.
3. Configure the platform
# config/packages/ai.yaml (or e.g. config/packages/ai_anthropic_platform.yaml) ai: platform: anthropic: api_key: '%env(ANTHROPIC_API_KEY)%'
4. Adjust the auditor config
The Flex recipe already created this file. Pick your model and report what the deterministic scans find (redacted secrets, pre-scan matches) as reviewed findings:
# config/packages/symfony_security_auditor.yaml symfony_security_auditor: model: 'claude-opus-5-5' audit: report_static_findings: true
Optionally pick a one-knob preset, fast, balanced (default), or thorough:
# config/packages/symfony_security_auditor.yaml symfony_security_auditor: profile: 'fast'
A profile only fills the keys you leave unset: any explicitly configured key always wins. See Cost & Performance for exactly what each profile sets.
5. Run
# audit the current directory (`bin/console audit` is an equivalent alias) bin/console audit:run # or point at another project bin/console audit:run /path/to/your/symfony/project
Want JSON, SARIF, HTML, or Markdown instead? Add --format json --output report.json, --format sarif --output report.sarif, --format html --output report.html, or --format markdown --output report.md. Since 1.23 --output alone is enough: without --format, while audit.format is written or left at console, the extension of the file picks the format. 1.22 wrote the console report to such a file: --format console keeps it. See CLI reference.
Estimate cost before running:
bin/console audit:run --dry-run
Warning
Audit reports list your application's vulnerabilities. On a public repository, CI artifacts are publicly downloadable, so storing the report exposes your attack surface. Prefer GitHub Code Scanning (SARIF, restricted to collaborators), private storage (S3/GCS with IAM), or notification-only. See Report Visibility on Public Repositories.
Tip
Schedule the audit as a nightly CI job: the multi-agent LLM loop can take minutes, so blocking PRs on it hurts productivity. CI Integration has ready-to-copy GitHub Actions and GitLab CI schedules and a split-model config to control API costs. For dependency CVEs, pair it with Dependabot or Renovate. This auditor targets the application-level logic flaws those scanners cannot see.
Use it from your AI assistant (MCP)
Warning
mcp:serve is experimental. The command, the audit tool and its input schema may change in any release (including a MINOR or PATCH one) and are not covered by the backward compatibility promise.
mcp:serve starts a Model Context Protocol server, so any MCP client (Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Gemini CLI, Codex CLI, …) can audit a project on request and read back the JSON report. It works from the standalone binary and from the bundle alike:
# Claude Code, with the standalone binary
claude mcp add --transport stdio symfony-security-auditor -- symfony-security-auditor mcp:serve
{
"mcpServers": {
"symfony-security-auditor": {
"command": "symfony-security-auditor",
"args": ["mcp:serve"]
}
}
}
The second snippet is the shape Claude Desktop, Cursor, Windsurf and Gemini CLI read; with the bundle, use "command": "php" and "args": ["/absolute/path/to/bin/console", "mcp:serve"].
With the binary, the server reads its configuration once, when it starts (your user config and the .symfony-security-auditor.yaml of the folder it starts in) and applies it to every project it audits, never the audited project's own file: start it from the project it will audit (see Per-project overrides).
Note
The audit still runs on your configured provider and model, not on the assistant's, so it needs the same API key as a CLI run. With the binary, store it once with auth:set so a desktop client finds it. Point the auditor at a local Ollama and it needs no key at all. Setup for every client, including VS Code and Codex CLI: mcp:serve.
Features
- Finds what SAST tools miss: an Attacker agent hunts, a Reviewer agent rejects false positives, over up to three rounds: broken access control, IDOR, business-logic flaws, injections and 50 vulnerability types mapped to OWASP and CWE.
- Knows Symfony: controllers, voters, firewalls,
access_control, forms,#[IsGranted],#[MapRequestPayload], Twig and Live Components, Messenger, Webhooks, API Platform. It flags routes without an access check and reads a controller together with its entity, repository, form, voter and templates. - Pull-request ready:
--since=mainaudits only the changed files. The GitHub Action (uses: vinceamstoutz/symfony-security-auditor@1.23.0) posts annotations, a PR comment and one-click fix suggestions; SARIF feeds GitHub Code Scanning and GitLab. See CI Integration. - Actionable findings: each one has its file and line, a CVSS v4.0 estimate and a remediation, plus, on request, a reproduction and a suggested patch.
- Any model: Claude, GPT, Gemini, Mistral, DeepSeek, Bedrock, Azure OpenAI, any OpenAI-compatible gateway, a local Ollama, or your Claude or ChatGPT subscription.
- Private by default: secrets are scrubbed before any code leaves your machine;
privacy.offline_onlyenforces a fully local run (see Security by design). - Cost under control:
--dry-runestimates the bill, budgets stop a run at a cap. Profiles, split models, caching and concurrency cut cost and time (see Cost & Performance). - Works with your other tools: imports PHPStan, Psalm or Semgrep results as leads through SARIF and checks dependency CVEs with
composer audit. - Nine report formats: console, executive summary, JSON, SARIF, HTML, Markdown, JUnit, GitHub annotations and PR comment. A baseline and
--min-scorelet CI fail on new findings only. - Findings over time:
audit:diffcompares two reports,audit:trendtracks a series,audit:baselinemaintains accepted findings. - From your AI assistant:
mcp:serve(experimental) lets Claude Code, Cursor, VS Code or any MCP client run an audit. - Extensible: strict DDD layers behind one
LLMClientInterfaceseam for custom providers, stages, advisory feeds or report formats; project-specific attacker rules need only configuration. - Bundle or standalone: add it to a Symfony app, or audit any project with one self-contained binary, kept current by
self-updateand checked bydoctor.
Security by design
The auditor is conservative about what leaves your machine:
- Secrets are scrubbed before they leave your machine. With
scan.secret_scrubbing.enabled: true(the default), credential-shaped strings are redacted from file content before it reaches the LLM: AWS / GitHub / Stripe / Slack / Google API keys, JWTs, PEM private keys, Symfony secrets-vault decryption keys, env-style credential assignments,Authorizationheaders, connection-string URIs with embedded credentials (postgres://user:pass@host) and the credentials passed in code to PDO, LDAP, Redis or HttpClient. Add project-specific shapes withscan.secret_scrubbing.additional_patterns. - The cache never stores your files. The filesystem cache keys LLM responses by content hash. An entry holds the findings the model reported (with the short source excerpts it quoted) and the reviewer's reasoning (never a project file), so treat
cache.dirlike a report: keep it out of shared CI caches and public artifacts. - You choose where the code goes. Source is sent only to the provider you wire in
ai.yaml. For zero third-party exposure, run fully offline with Ollama: nothing leaves your network. Setprivacy.offline_only: trueto have that enforced rather than assumed: the advisory feed is dropped (nocomposer audit) and the standalone CLI refuses to boot against a platform endpoint that is not loopback or private-range.docs/faq.mdcarries atcpdumprecipe for verifying it yourself. - Reports are sensitive: they list your weak spots. On public repos, prefer SARIF → GitHub Code Scanning (collaborator-only) over downloadable CI artifacts. See Report Visibility.
Supported Platforms
Any platform symfony/ai supports (Anthropic, OpenAI, Azure OpenAI, Gemini, Vertex AI, Bedrock, Mistral, DeepSeek, Ollama, OpenRouter, any OpenAI-compatible gateway through the generic platform and more), plus a Claude or ChatGPT subscription through the Claude Code or Codex CLI. Swapping providers is a configuration change, no PHP edits. Bridges, keys and examples: Configuration → Supported platforms.
Documentation
- Configuration: every config key, all platforms, split-model, model options, CLI reference
- Switching Binary and Bundle: move a setup from the standalone binary to the bundle and back
- Cost & Performance: profiles, split-model, concurrency, caching, budgets and rate-limit handling
- Architecture: DDD layers, pipeline, agent loop, domain model, design decisions
- CI Integration: scheduled GitHub Actions & GitLab CI, SARIF upload, cost management
- Extending: custom LLM clients, agents, pipeline stages, report formats
- FAQ: accuracy, cost, privacy, model picks, comparisons
- Troubleshooting: empty reports, LLM errors, composer audit failures, cache issues
- Contributing: dev setup, Docker workflow, QA, PR checklist
Contributing
Contributions welcome, please refer to CONTRIBUTING.md.
Security
Found a vulnerability in the auditor itself? Do not open a public issue. Report privately via GitHub Security Advisories.
See SECURITY.md.
License
MIT. Copyright © Vincent Amstoutz



