Baselines allow you to acknowledge existing security findings while ensuring new issues are caught and addressed. This is essential when introducing Ward into an existing project or managing technical debt.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.
What is a Baseline?
A baseline is a snapshot of current security findings in your project. When you scan with a baseline file, Ward:- Suppresses findings that are already in the baseline
- Reports only new findings that aren’t in the baseline
- Optionally fails CI builds based on new findings only
- Findings persist even if descriptions or remediation text changes
- Moving code to a different line creates a new finding
- Renaming files creates a new finding
Creating a Baseline
Initial Baseline Creation
When first introducing Ward to a project, generate a baseline of current findings:.ward-baseline.json containing all findings from the scan:
Commit
.ward-baseline.json to your repository to share the baseline across your team and CI pipeline.Using a Baseline
Suppress Known Findings
Run Ward with the--baseline flag to suppress findings already in the baseline:
Combining with Fail Thresholds
Use baselines with--fail-on in CI to fail builds only when new High or Critical findings are detected:
- Loads the baseline from
.ward-baseline.json - Suppresses all findings already in the baseline
- Exits with code 1 if any new High or Critical findings are discovered
- Exits with code 0 if all findings are baselined or below High severity
Updating a Baseline
When to Update
Update your baseline when:- You’ve fixed findings and want to remove them from the baseline
- You’ve acknowledged new findings as acceptable technical debt
- You’ve refactored code and line numbers have changed
Update Workflow
Review the changes
Check what changed in the baseline:Ensure the changes reflect your intent (e.g., removed entries for fixed findings, new entries for acknowledged issues).
Baseline Workflow Examples
Legacy Project Introduction
When introducing Ward to a project with many existing findings:Gradual Remediation
Use baselines to track remediation progress over time:git log .ward-baseline.json or by comparing baseline file sizes.
Baseline Implementation Details
Fingerprint Generation
Ward generates fingerprints using a SHA-256 hash of the finding’s:- Rule ID (e.g.,
ENV-002) - File path (e.g.,
app/Http/Controllers/UserController.php) - Line number (e.g.,
42)
internal/models/finding.go:
- Findings remain consistent across scans even if descriptions change
- Refactoring code (changing line numbers) creates new findings
- Renaming files creates new findings
Baseline Filtering
When a baseline is loaded, Ward filters findings before reporting. Frominternal/baseline/baseline.go:
Best Practices
1. Commit Baselines to Version Control
Always commit.ward-baseline.json to your repository:
- Team members see the same baseline
- CI pipelines use the correct baseline
- Baseline changes are reviewed via pull requests
2. Review Baseline Changes
Before committing baseline updates, review the diff:- Removed entries correspond to fixed findings
- New entries are intentional acknowledgments, not overlooked issues
3. Use Descriptive Commit Messages
Document why the baseline changed:4. Don’t Baseline Critical Findings
Avoid baselineing Critical findings unless absolutely necessary. Critical findings represent immediate security risks (e.g., emptyAPP_KEY, eval() usage) and should be fixed, not suppressed.
5. Periodically Review Baselines
Schedule regular reviews of your baseline:Baseline File Format
The baseline file is JSON with the following structure:| Field | Description |
|---|---|
version | Baseline format version (currently 1.0) |
created_at | Timestamp when baseline was first created |
updated_at | Timestamp of last baseline update |
entries | Array of baselined findings |
entries[].fingerprint | Stable SHA-256 hash of rule ID + file + line |
entries[].id | Rule ID (e.g., ENV-002) |
entries[].file | Relative path to the file containing the finding |
entries[].line | Line number where the finding was detected |
entries[].title | Finding title (for human readability) |
entries[].severity | Severity level (Info, Low, Medium, High, Critical) |
Troubleshooting
Baseline not suppressing findings
Symptom: Findings appear in scan results despite being in the baseline. Causes:- Line numbers changed due to code edits (fingerprint changed)
- File was moved or renamed (fingerprint changed)
- Rule ID changed in a Ward update
Baseline file not found in CI
Symptom: CI fails with “loading baseline: no such file or directory”. Solution: Ensure.ward-baseline.json is committed and pushed:
Accidentally overwrote baseline
Symptom: Baseline file is missing expected entries after running--update-baseline.
Solution: Restore from git history: