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.
Overview
Ward rules are defined in YAML files located in~/.ward/rules/. Each rule file can contain multiple rules that define pattern-based security checks.
Rules are automatically loaded from:
~/.ward/rules/*.yaml(default rules)~/.ward/rules/*.yml- Custom directories specified in
config.yamlunderrules.custom_dirs
Rule File Structure
Each YAML file must have a top-levelrules array:
Rule Schema
Unique identifier for the rule. Used for disabling rules and tracking findings.Naming convention:
CATEGORY-NNN (e.g., SECRET-001, AUTH-003, XSS-002)Short, human-readable title for the finding. Displayed in reports and TUI.Keep it concise (under 80 characters) and actionable.
Detailed explanation of the security issue and why it matters.Should explain:
- What the rule detects
- Why it’s a security concern
- Potential impact
Severity level of findings from this rule.Valid values:
critical, high, medium, low, infoCan be overridden per-rule in config.yaml.Category or class of security issue. Used for grouping findings in reports.Common categories:
Secrets ManagementInjectionXSSAuthenticationAuthorizationCryptographyConfigurationDebug & LoggingFile UploadSession Management
Whether this rule is active.Set to
false to disable the rule without deleting it. Can also be disabled globally in config.yaml.List of pattern checks that trigger this rule. At least one pattern must match for a finding to be created.See Pattern Definition below.
Optional tags for categorization and filtering.
Instructions for fixing the issue. Displayed in the TUI detail panel and reports.Should include:
- Specific steps to remediate
- Code examples (before/after)
- Links to documentation
URLs to external documentation, advisories, or guides.
Pattern Definition
Each pattern defines a specific check to perform on files. Source:internal/config/rules.go:26
Type of pattern matching to perform.Valid values:
regex- Regular expression match (line-by-line)contains- Exact substring matchfile-exists- Check if a file matching the glob exists
Which files to scan. Can be a predefined target alias or a custom glob pattern.Predefined targets:
php-files- All.phpfiles (recursive, skipsvendor/)blade-files-resources/views/**/*.blade.phpconfig-files-config/*.phpenv-files-.env,.env.*routes-files-routes/*.phpmigration-files-database/migrations/*.phpjs-files-resources/js/**/*.{js,ts,jsx,tsx}
app/Models/*.php**/*.blade.php.env.example
The pattern to search for. Format depends on the
type:- regex: Regular expression (Go syntax)
- contains: Exact string
- file-exists: Not used (target is the glob)
If
true, triggers when the pattern is absent rather than present.Useful for “must have” checks like required security headers or CSRF tokens.If specified, lines matching this pattern are excluded even if they match the main pattern.Reduces false positives by filtering out known safe cases.
Complete Example
Here’s a full rule file with multiple rules:Rule Location
Rules are loaded from:- Default rules:
~/.ward/rules/*.yaml(created byward init) - Custom directories: Specified in
config.yaml:
Rule Overrides
You can disable or modify rules without editing the YAML files by usingconfig.yaml:
Built-in Rules
Ward ships with 40 default rules across 7 categories:- secrets.yaml - 7 rules for hardcoded credentials
- injection.yaml - 6 rules for SQL/command/code injection
- xss.yaml - 4 rules for cross-site scripting
- debug.yaml - 6 rules for debug artifacts
- crypto.yaml - 5 rules for weak cryptography
- security-config.yaml - 7 rules for configuration issues
- auth.yaml - 5 rules for authentication/authorization
~/.ward/rules/ after running ward init.