What It Detects
- Data exfiltration - List followed by send, or query followed by export sequences
- Excessive access - High limits, wildcard queries
- Fan-out attacks - Tool calls inside loops
- Sensitive data access - Passwords, tokens, PII fields
Basic Configuration
Scorer Types
| Type | Latency | Dependencies | Detection |
|---|---|---|---|
disabled | 0ms | None | None |
rule-based | ~1ms | None | Good |
local-llm | ~5-10ms | Model download | Better |
external-api | ~100ms | Network | Best |
Rule-Based Scorer
Fast, zero-dependency scoring using predefined rules:External API Scorer
Best detection using an external scoring service:Local LLM Scorer
Balance between speed and detection using a local model:Similarity Mode with VectoriaDB
For pattern-matching against known malicious code patterns, use similarity mode with VectoriaDB:| Option | Type | Default | Description |
|---|---|---|---|
threshold | number | 0.85 | Similarity threshold (0-1) for considering a match |
topK | number | 5 | Maximum number of similar patterns to return |
modelName | string | Inherits from localLlm.modelId | Embedding model for similarity computation |
Similarity mode requires the optional
vectoriadb peer dependency:Detection Rules
The rule-based scorer evaluates these patterns:| Rule | Score | Description |
|---|---|---|
SENSITIVE_FIELD | 35 | Queries password/token/secret fields |
EXCESSIVE_LIMIT | 25 | limit > 10,000 |
WILDCARD_QUERY | 20 | query=”*” or filter= |
LOOP_TOOL_CALL | 25 | callTool inside for/for-of loop |
EXFIL_PATTERN | 50 | list followed by send or query followed by export sequence |
EXTREME_VALUE | 30 | Numeric arg > 1,000,000 |
DYNAMIC_TOOL | 20 | Variable tool name (not static string) |
BULK_OPERATION | 15 | Tool name contains bulk/batch/all |
Thresholds
Configure how scores translate to actions:Custom Analyzer
Add custom analysis logic:Feature Extraction
The scorer extracts these features for analysis:- Tool names - All
callTool()targets - Arguments - Numeric values, field names, patterns
- Control flow - Loops containing tool calls
- Data flow - Variables passed between tool calls
- Sequences - Order of operations
Handling Scoring Results
Logging and Monitoring
Best Practices
- Start with warnings - Use
warnThresholdto monitor before blocking - Tune thresholds - Adjust based on your false positive rate
- Use fail-open cautiously - Only in non-critical paths
- Monitor signals - Track which rules trigger most often
- Layer with other defenses - Scoring complements AST validation
Breaking Changes
v2.x: VectoriaConfigForScoring API Changes
Removed:indexPath option
The indexPath option has been removed from VectoriaConfigForScoring. This option was intended to load pre-built malicious pattern indexes, but VectoriaDB v2.x handles persistence differently using storage adapters.
Migration:
indexPath to load pre-built indexes, you’ll need to handle persistence externally using VectoriaDB’s storage adapter APIs (saveToStorage(), MemoryStorageAdapter, FileStorageAdapter, or RedisStorageAdapter).
New options in v2.x:
topK- Control how many similar patterns to consider (default: 5)modelName- Override the embedding model (defaults tolocalLlm.modelId)
Related
- Security Levels - Security presets
- Double VM - Operation validation layer
- ast-guard - AST validation