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
Targets define which files Ward scans when evaluating a rule pattern. Ward provides predefined target aliases for common Laravel file types, plus support for custom glob patterns. Source: Documentation from READMEPredefined Targets
These target aliases map to specific file patterns in a Laravel project.All PHP files in the project, excluding
vendor/ directory.Expands to: **/*.php (recursive, skips vendor/)Use for:- General PHP code scanning
- Controller, model, service class checks
- Any rule that applies to all PHP code
Laravel Blade template files.Expands to:
resources/views/**/*.blade.phpUse for:- XSS detection (unescaped output)
- CSRF token checks
- Template security issues
Laravel configuration files.Expands to:
config/*.phpUse for:- Hardcoded credentials in config
- Insecure configuration values
- Missing security settings
Environment variable files.Expands to:
.env, .env.*Use for:- Checking
.env.examplefor leaked secrets - Detecting
.envin version control - Environment configuration issues
Laravel route definition files.Expands to:
routes/*.phpUse for:- Missing authentication middleware
- Route security configuration
- API protection checks
Database migration files.Expands to:
database/migrations/*.phpUse for:- Sensitive data in migrations
- Insecure default values
- Migration security issues
JavaScript and TypeScript files in Laravel frontend.Expands to:
resources/js/**/*.{js,ts,jsx,tsx}Use for:- Frontend security issues
- API key exposure in JavaScript
- Insecure client-side code
Custom Glob Patterns
You can specify any custom glob pattern as a target:Glob Syntax
Ward uses standard glob syntax:| Pattern | Description | Example |
|---|---|---|
* | Matches any characters (not /) | *.php matches file.php |
** | Matches any characters including / | **/*.php matches app/Models/User.php |
? | Matches single character | file?.php matches file1.php |
[abc] | Matches any character in set | file[123].php |
{a,b} | Matches any of the alternatives | *.{js,ts} matches .js and .ts |
Custom Target Examples
Target Resolution
When Ward processes a rule:- Parse target - Determine if it’s a predefined alias or custom glob
- Expand to files - Resolve the pattern to actual file paths
- Apply filters - Exclude
vendor/,node_modules/,.git/ - Return file list - Pass matching files to pattern matcher
Target Combinations
A single rule can have multiple patterns with different targets:Performance Optimization
Use Specific Targets
config-files is faster than php-files when you only need to scan configs.Avoid Deep Recursion
app/Models/*.php is faster than **/*.php when you know the location.Group Similar Patterns
Multiple patterns with the same target are more efficient than separate rules.
Exclude Vendor Code
Predefined targets automatically skip
vendor/ - use them when possible.Excluded Directories
Ward automatically excludes these directories from all scans:vendor/- Composer dependenciesnode_modules/- NPM dependencies.git/- Git metadatastorage/framework/- Laravel cache/compiled filesbootstrap/cache/- Laravel bootstrap cache
Target Reference Table
| Target | Path Pattern | Use Case |
|---|---|---|
php-files | **/*.php (excludes vendor) | General PHP code |
blade-files | resources/views/**/*.blade.php | Templates, XSS |
config-files | config/*.php | Configuration security |
env-files | .env, .env.* | Environment secrets |
routes-files | routes/*.php | Route protection |
migration-files | database/migrations/*.php | Database schema |
js-files | resources/js/**/*.{js,ts,jsx,tsx} | Frontend code |
app/Models/*.php | Custom - all models | Model-specific checks |
app/Http/Controllers/**/*.php | Custom - all controllers | Controller security |
.env.example | Custom - specific file | Example file leaks |
**/*.blade.php | Custom - all Blade files | Deep Blade scan |
Best Practices
Use Predefined Targets When Possible
Use Predefined Targets When Possible
Predefined targets like
php-files and blade-files are optimized and exclude vendor code automatically.Be Specific for Performance
Be Specific for Performance
Narrow targets reduce scan time:
Test Custom Globs
Test Custom Globs
Verify your glob pattern matches the intended files:
Document Custom Targets
Document Custom Targets
Add a comment in your rule explaining non-standard targets:
Related
- Rule Format - Complete YAML schema
- Pattern Types - Pattern matching reference
- CLI Options - Command-line flags