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
- psr/log: ^3.0
- symfony/ai-bundle: ^0.9
- symfony/config: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/filesystem: ^7.4 || ^8.0
- symfony/finder: ^7.4 || ^8.0
- symfony/process: ^7.4 || ^8.0
- symfony/validator: ^7.4 || ^8.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.52
- ergebnis/phpunit-agent-reporter: ^0.3
- ergebnis/phpunit-slow-test-detector: ^2.24
- friendsofphp/php-cs-fixer: ^3.95
- 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: ^11.5
- rector/rector: ^2.4
- robiningelbrecht/phpunit-coverage-tools: ^1.10
- staabm/phpstan-todo-by: ^0.3
- symfony/dotenv: ^7.4 || ^8.0
- symfony/var-dumper: ^7.4 || ^8.0
Suggests
- symfony/ai-anthropic-platform: Anthropic (Claude) platform bridge — claude-opus-4-5, claude-sonnet-4-5
- symfony/ai-azure-platform: Azure OpenAI platform bridge — enterprise GPT-4o, o3
- symfony/ai-bedrock-platform: AWS Bedrock platform bridge — Claude, Nova, Llama on AWS
- symfony/ai-deep-seek-platform: DeepSeek platform bridge — deepseek-chat, deepseek-reasoner
- symfony/ai-gemini-platform: Google Gemini platform bridge — gemini-2.5-pro, gemini-2.0-flash
- symfony/ai-meta-platform: Meta (Llama) platform bridge — Llama-4-Scout, Llama-3.3
- symfony/ai-mistral-platform: Mistral platform bridge — mistral-large, codestral
- 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-4o, gpt-4.1, o3, o4-mini
- symfony/ai-open-responses-platform: OpenAI Responses API platform bridge
- symfony/ai-vertex-ai-platform: Google Vertex AI platform bridge — Gemini + Claude on GCP
This package is auto-updated.
Last update: 2026-05-23 21:42:36 UTC
README
AI-powered multi-agent security auditor for Symfony applications. Catches business logic flaws, broken access control, missing Voters, mass assignment, and complex injection chains that traditional SAST tools miss. Provider-agnostic via
symfony/ai— works with Claude, GPT, Gemini, Mistral, Llama, DeepSeek, and Ollama.
Stable & predictable.
symfony-security-auditorfollows Semantic Versioning 2.0.0. The public API — configuration keys,audit:runarguments and options, exit codes, JSON / SARIF output schemas, and the Domain ports listed indocs/extending.md— is covered by our backward compatibility promise. Details:docs/versioning.md.
Table of Contents
- What it does
- Getting Started
- Features
- Why this auditor?
- Example Output
- Supported Platforms
- Documentation
- FAQ
- Contributing
- Security
- License
What it does
Feeds your Symfony project through a three-stage AI pipeline that catches what SAST tools miss: broken access control, complex injection chains, business logic flaws, missing Voters, and mass assignment vulnerabilities. An adversarial Attacker agent hunts for issues; a skeptical Reviewer agent eliminates false positives over up to three iterations. Output is a validated vulnerability report in your console, as JSON, or as SARIF for GitHub Code Scanning / GitLab Security Dashboard.
Project files
│
▼
1. Ingestion — scans .php / .twig / .yaml / .xml recursively
│
▼
2. Mapping — classifies Controllers, Entities, Voters, Forms, Routes
│
▼
3. Audit — Attacker ⚔ Reviewer multi-agent loop (up to 3 iterations)
│
▼
Validated vulnerability report: console, JSON, or SARIF
Getting Started
1. Install
composer require --dev vinceamstoutz/symfony-security-auditor
2. Install a platform bridge (Anthropic shown)
composer require symfony/ai-anthropic-platform
Full list of supported providers: Configuration → Supported platforms.
3. Register bundles (config/bundles.php)
Symfony Flex does this automatically via recipe. Otherwise:
return [ // ... Symfony\AI\AiBundle\AiBundle::class => ['all' => true], VinceAmstoutz\SymfonySecurityAuditor\SymfonySecurityAuditorBundle::class => ['dev' => true, 'test' => true], ];
4. Configure the platform (config/packages/ai.yaml)
ai: platform: anthropic: api_key: '%env(ANTHROPIC_API_KEY)%'
5. Configure the auditor (config/packages/symfony_security_auditor.yaml)
symfony_security_auditor: model: 'claude-opus-4-5'
6. Run
bin/console audit:run /path/to/your/symfony/project
Want JSON or SARIF instead? Add --format json --output report.json or
--format sarif --output report.sarif. See
CLI reference.
Warning
Security audit reports contain a list of vulnerabilities in your application. On a public repository, GitHub Actions artifacts and GitLab CI artifacts are publicly downloadable — storing the report as an artifact exposes your attack surface to anyone.
Safe options: GitHub Code Scanning (SARIF upload — restricted to collaborators even on public repos), external private storage (S3, GCS with IAM), or notification-only (Slack/email, no stored file). See Report Visibility on Public Repositories for details.
Tip
Schedule the audit as a nightly CI job — the multi-agent LLM loop can take minutes, so blocking PRs on it hurts productivity. See CI Integration for ready-to-copy GitHub Actions and GitLab CI schedules (SARIF → Code Scanning / Security Dashboard). Use a split-model config (large attacker, cheap reviewer) to control API costs.
For dependency CVEs, use
Dependabot or
Renovate — they automate composer audit
checks and open PRs automatically. This auditor targets application-level
logic flaws (broken access control, injection chains, missing Voters) that
static dependency scanners cannot see.
Features
- Multi-agent loop — adversarial Attacker + skeptical Reviewer cut false positives across up to 3 iterations.
- 32 vulnerability types covering 6 OWASP-aligned categories: Injection, Broken Access Control, Logic Flaws, Symfony-specific, Data Exposure, Cryptographic.
- Symfony-aware — understands Controllers, Voters, Forms, Firewalls, Routes,
#[IsGranted],denyAccessUnlessGranted, and surfaces controllers without proper access checks. - Provider-agnostic — swap Claude / GPT / Gemini / Mistral / Llama / DeepSeek / Ollama with a 2-line YAML change. No code edits.
- Cross-file investigation tools — the Attacker can
read_file,grep,list_files, andlookup_advisory(live CVE lookups viacomposer audit). - Split-model support — pair a powerful Attacker (e.g. Claude Opus) with a fast Reviewer (e.g. Claude Haiku) to cut cost ~20×.
- Prompt caching — Anthropic prompt caching enabled by default (~90% input-token discount), silently ignored elsewhere.
- Content-hash cache — identical chunks skip the LLM entirely. Massive savings on repeated CI runs.
- Three output formats —
console(human-readable),json(machine-readable),sarif(GitHub Code Scanning / GitLab Security Dashboard). - CI-ready — drop-in GitHub Actions and GitLab CI templates with SARIF upload included.
- Zero-config CVE feed —
lookup_advisoryis backed bycomposer audit(Packagist + GitHub Security Advisories) out of the box. - DDD architecture — strict layering, sole
LLMClientInterfaceseam means you can plug in custom providers, agents, stages, advisory feeds, or report formats.
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.
| Concern | This auditor | PHPStan / Psalm | Psalm Security / Progpilot (SAST) | Dependabot / Snyk |
|---|---|---|---|---|
| Type bugs | ❌ | ✅ | partial | ❌ |
| Taint flow (SQLi, XSS) | ✅ | ❌ | ✅ | ❌ |
Missing #[IsGranted] / Voter |
✅ | ❌ | ❌ | ❌ |
| Business logic flaws | ✅ | ❌ | ❌ | ❌ |
| IDOR / mass assignment | ✅ | ❌ | partial | ❌ |
| Firewall misconfiguration | ✅ | ❌ | ❌ | ❌ |
| Cross-file attack chains | ✅ | ❌ | partial | ❌ |
| Dependency CVEs | ✅ (via lookup_advisory) |
❌ | ❌ | ✅ |
| OWASP Top 10 application-level coverage | ✅ | ❌ | partial | ❌ |
Use this alongside — not instead of — PHPStan/Psalm and Dependabot. It targets the application-level logic flaws those tools cannot see.
Example Output
Console mode (truncated):
══════════════════════════════════════════════════════════════════════
🔍 SYMFONY LLM AUDIT REPORT — AUDIT-a1b2c3d4
vinceamstoutz/symfony-security-auditor
══════════════════════════════════════════════════════════════════════
Project : /var/www/my-app
Started : 2026-05-22 09:14:02
Duration: 2m 31s
Files : 142 scanned
──────────────────────────────────────────────────────────────────────
RISK LEVEL: HIGH (Score: 34)
──────────────────────────────────────────────────────────────────────
[1] VULN-7f3a1b2c CRITICAL broken_access_control
src/Controller/AdminController.php:42-58
Title: Missing #[IsGranted] on admin DELETE endpoint
OWASP: A01:2021 — Broken Access Control
Confidence: 0.95 Reviewer: ✓ validated
[2] VULN-2e9d5c1a HIGH mass_assignment
src/Controller/UserController.php:71-89
Title: Form type binds isAdmin field from untrusted request
OWASP: A04:2021 — Insecure Design
Confidence: 0.88 Reviewer: ✓ validated
... (3 more findings)
JSON / SARIF formats are documented in CLI Reference and Output Formats Reference.
Supported Platforms
| Platform | Bridge package | Key env var |
|---|---|---|
| Anthropic (Claude) | symfony/ai-anthropic-platform |
ANTHROPIC_API_KEY |
| OpenAI | symfony/ai-open-ai-platform |
OPENAI_API_KEY |
| OpenAI Responses API | symfony/ai-open-responses-platform |
OPENAI_API_KEY |
| Azure OpenAI | symfony/ai-azure-platform |
AZURE_OPENAI_API_KEY |
| Google Gemini | symfony/ai-gemini-platform |
GEMINI_API_KEY |
| Google Vertex AI | symfony/ai-vertex-ai-platform |
GCP credentials |
| AWS Bedrock | symfony/ai-bedrock-platform |
AWS credentials |
| DeepSeek | symfony/ai-deep-seek-platform |
DEEPSEEK_API_KEY |
| Mistral | symfony/ai-mistral-platform |
MISTRAL_API_KEY |
| Meta (Llama) | symfony/ai-meta-platform |
META_API_KEY |
| Ollama (local) | symfony/ai-ollama-platform |
(none) |
Swapping providers requires only a config/packages/ai.yaml change — no PHP
edits.
Documentation
- Configuration — every config key, all platforms, split-model, model options, CLI reference
- 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
FAQ
Is this a replacement for PHPStan or Psalm? No. PHPStan/Psalm catch type errors; this auditor catches application-level logic flaws (missing authorization, mass assignment, business logic bugs). Use both.
How much does an audit cost? Depends on project size and model. A medium Symfony app (~150 files) on Claude Opus + Haiku split-model with prompt caching enabled costs roughly $0.50 per nightly run. See CI → Managing LLM Costs.
Does it send my code to the cloud? Only to the LLM provider you configure. For zero-cloud operation, use the Ollama local platform. See FAQ → Privacy.
Are false positives a problem? The Reviewer agent filters them out — only
reviewer_validated findings appear in the final report. Tune
audit.min_confidence (default 0.6) up for stricter precision, down for
higher recall.
Which model should I pick? For accuracy: Claude Opus / GPT-4o / Gemini 2.5
Pro. For speed/cost: Claude Haiku / DeepSeek / Mistral Large. For zero-cost
local: Ollama (llama3.3, deepseek-r1). See
FAQ → Model picks.
Full FAQ: docs/faq.md.
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