Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Eljakani/ward/llms.txt
Use this file to discover all available pages before exploring further.
Pipeline Overview
Ward executes scans through a sequential 5-stage pipeline. Each stage has a specific responsibility and publishes events to track progress:internal/orchestrator/orchestrator.go:49-271
Stage 1: Provider
Purpose: Locate and prepare your project source code for scanning. The Provider stage determines where the project code comes from and ensures it’s accessible for analysis.Provider Types
- Local Provider
- Git Provider
Source:
internal/provider/local.goScans a project from the local filesystem.What it does:- Validates the path exists and is accessible
- Checks for Laravel indicators (
composer.json,artisan) - Returns the absolute path to the project root
Laravel Detection
The provider checks if the project appears to be Laravel by looking for:composer.jsonfileartisanCLI scriptapp/,config/, orroutes/directories
Events Published
The Provider automatically cleans up temporary directories (for Git clones) after the scan completes, even if there’s an error.
Stage 2: Resolvers
Purpose: Parse Laravel project files to build a structuredProjectContext that all scanners can consume.
Resolvers run in priority order and populate different fields of the shared context.
Resolver Execution
Source:orchestrator.go:108-133
Resolver Types
- Framework Resolver
- Package Resolver
Source:
internal/resolver/framework.goPriority: 10 (runs first)What it parses:composer.json→ Laravel version, PHP version, project name.env→ Environment variables (APP_DEBUG, APP_ENV, DB_PASSWORD, etc.)
Project Context Structure
Source:internal/models/context.go
Events Published
Stage 3: Scanners
Purpose: Run independent security checks against the resolved project context. All scanners execute with the sharedProjectContext but operate independently. If one scanner fails, others continue.
Scanner Registration
Source:orchestrator.go:52-73
Scanner Execution
Source:orchestrator.go:136-186
Each scanner:
- Publishes
EventScannerStarted - Receives the
ProjectContextand anemitcallback - Performs its security checks
- Emits findings in real-time via callback
- Returns all findings as a slice
- Publishes
EventScannerCompletedwith finding count
Built-in Scanners
env-scanner
Source:
internal/scanner/env/scanner.go8 checks for .env misconfigurations:- Missing
.envfile APP_DEBUG=true- Empty/weak
APP_KEY - Non-production
APP_ENV - Empty
DB_PASSWORD - File sessions in production
- Real credentials in
.env.example
config-scanner
Source:
internal/scanner/configscan/scanner.go13 checks for config/*.php security issues:- Hardcoded debug mode
- Weak encryption cipher
- Missing cookie security flags
- CORS wildcards
- Hardcoded credentials in config
- Long session/token lifetimes
dependency-scanner
Source:
internal/scanner/dependency/scanner.goLive CVE database lookup via OSV.dev:- Queries for all packages in
composer.lock - Batch requests for performance
- Returns CVE ID, severity, affected versions
- Includes remediation with fixed version
rules-scanner
Source:
internal/scanner/rules/scanner.go40 default YAML pattern rules:- Secrets (7 rules)
- Injection (6 rules)
- XSS (4 rules)
- Debug artifacts (6 rules)
- Weak crypto (5 rules)
- Security config (7 rules)
- Auth issues (5 rules)
Scanner Interface
Source:internal/models/scanner.go
All scanners implement:
Scanner Configuration
You can disable scanners in~/.ward/config.yaml:
Events Published
Stage 4: Post-Process
Purpose: Clean, filter, and enrich scan results before reporting. The Post-Process stage applies several transformations to the raw findings:Processing Steps
Source:orchestrator.go:188-204
Deduplication
Remove duplicate findings using a composite key:This ensures the same issue at the same location is only reported once, even if multiple scanners detect it.
Severity Filtering
Filter findings based on the minimum severity threshold from config:Findings below the threshold are silently discarded.
Baseline Comparison
If a baseline file is provided (This shows only new findings introduced since the baseline was created.
--baseline .ward-baseline.json), suppress known findings:Events Published
Stage 5: Report
Purpose: Generate output files in configured formats and save scan history.Report Generation
Source:orchestrator.go:206-250
Ward creates a ScanReport containing:
- Project metadata from context
- All findings (after post-processing)
- Scan timestamps and duration
- Scanner execution status
- Any scanner errors
Report Formats
Reporters are selected based onconfig.yaml:
- JSON
- SARIF
- HTML
- Markdown
Source:
internal/reporter/json.goMachine-readable format containing the full ScanReport structure.Output: ward-report.jsonAlways generated as a baseline, even if not in the formats list.Scan History
Ward automatically saves each scan to~/.ward/store/ for historical comparison:
Source: internal/store/store.go
Baseline Updates
If--update-baseline is provided, save current findings as the new baseline:
Events Published
Pipeline Error Handling
Ward uses graceful error handling throughout the pipeline:Provider Errors
Provider Errors
Fatal — If the provider fails (path doesn’t exist, git clone fails), the scan stops immediately.
Resolver Errors
Resolver Errors
Non-fatal — If a resolver fails (missing file, parse error), Ward logs an error but continues.Scanners that depend on that data will skip related checks.
Scanner Errors
Scanner Errors
Non-fatal — If a scanner fails, Ward records the error but continues with other scanners.The error is included in the final report’s
ScannerErrors map.Reporter Errors
Reporter Errors
Non-fatal — If a reporter fails, Ward logs an error but continues with other formats.At least JSON is always attempted.
Performance Characteristics
Parallel Scanning
Scanners could run in parallel (not currently implemented), as they’re fully independent and share an immutable context.
Shallow Clones
Git provider uses
--depth=1 by default, significantly reducing clone time for large repositories.Batch CVE Queries
Dependency scanner sends packages to OSV.dev in batches of 100 for optimal API performance.
Event Streaming
The
emit callback allows real-time finding updates without waiting for scanner completion.Related Pages
Architecture
System architecture and design principles
Security Scanners
Deep dive into each scanner’s checks