Overview
Aguara uses the functional options pattern for configuration. All scanning functions accept variadicOption parameters:
Available Options
WithCustomRules
Source:options.go:19
dir- Path to directory containing YAML rule files
- Custom rules are merged with built-in rules
- Custom rules can override built-in rules with the same ID
- Directory is recursively scanned for
.yamland.ymlfiles - Invalid rules emit warnings to stderr but don’t fail the scan
WithDisabledRules
Source:options.go:26
ids- One or more rule IDs to disable
- Rule IDs are case-sensitive
- Use
aguara.ListRules()to see all available rule IDs - Disabled rules are completely skipped (not loaded into memory)
WithRuleOverrides
Source:options.go:32
overrides- Map of rule ID to override configuration
- Severity values are case-insensitive
- Invalid severity values emit warnings to stderr
Disabled: truetakes precedence overSeverity
WithMinSeverity
Source:options.go:40
sev- Minimum severity level
WithWorkers
Source:options.go:46
n- Number of worker goroutines (default:runtime.NumCPU())
- Higher worker counts improve performance for large directories
- Diminishing returns beyond
NumCPU * 2 - Memory usage scales with worker count (each worker buffers file content)
WithIgnorePatterns
Source:options.go:54
patterns- Slice of gitignore-style patterns
vendor/- Ignore directory and all contents*.log- Ignore all.logfilestest/*.md- Ignore.mdfiles intest/directory**/temp- Ignore alltempdirectories (recursive)
- Patterns use gitignore-style matching
- Always ignored:
.git/,node_modules/,.aguara/, binary files .aguaraignorefiles are also respected
WithMaxFileSize
Source:options.go:62
bytes- Maximum file size in bytes (0 = default 50 MB)
- Default limit: 50 MB
- Prevents memory exhaustion on very large files
- Skipped files are not counted in
FilesScanned
WithCategory
Source:options.go:69
ListRules(), not scanning functions.
Parameters:
cat- Rule category (case-insensitive)
prompt-injectioncredential-leakexfiltrationexternal-downloadsupply-chaincommand-executionmcp-attackssrf-cloudmcp-configunicode-attackindirect-injectionthird-party-contenttoxic-flowrug-pull
Combining Options
Example: Production Scan
Example: Development Scan
Example: CI/CD Scan
Option Scope
| Option | Scan() | ScanContent() | ListRules() | ExplainRule() |
|---|---|---|---|---|
WithCustomRules | ✓ | ✓ | ✓ | ✓ |
WithDisabledRules | ✓ | ✓ | - | - |
WithRuleOverrides | ✓ | ✓ | - | - |
WithMinSeverity | ✓ | ✓ | - | - |
WithWorkers | ✓ | - | - | - |
WithIgnorePatterns | ✓ | - | - | - |
WithMaxFileSize | ✓ | - | - | - |
WithCategory | - | - | ✓ | - |
Related
- Scan() - File/directory scanning
- ScanContent() - Inline content scanning
- ListRules() - List all rules
- ExplainRule() - Get rule details
