Overview
GaiterGuard evaluates every proxy request using a blended risk scoring model that combines:- LLM intent analysis — evaluates whether agent’s stated intent matches the actual request
- HTTP method heuristics — baseline risk scores for different HTTP methods
- Fail-closed behavior — escalates risk on LLM failure to prevent silent bypass
score >= RISK_THRESHOLD are blocked and queued for human approval.
The default threshold is 0.5 (configurable via
RISK_THRESHOLD environment variable). Scores range from 0.0 (no risk) to 1.0 (critical risk).Risk Scoring Model
Blended Score Calculation
The final risk score is a weighted blend of LLM and heuristic components:LLM Intent Analysis
The LLM assessor evaluates whether the agent’s stated intent matches the HTTP request:System Prompt
The LLM receives this system prompt (risk.service.ts:33):
User Prompt
The LLM receives the following context (risk.service.ts:70):
Response Format
The LLM must return JSON:HTTP Method Heuristics
Baseline risk scores by HTTP method (risk.service.ts:52):
Fail-Closed Behavior
If the LLM call fails (timeout, network error, invalid response), the gateway escalates the heuristic score by +0.3:Threshold Configuration
TheRISK_THRESHOLD determines which requests require approval:
backend/src/config/env.ts:41):
Threshold Tuning
- Conservative (0.3)
- Balanced (0.5)
- Permissive (0.7)
Blocks: Most write operations (POST, PUT, PATCH, DELETE)Passes: Only GET/HEAD requests with clear intent matchUse case: High-security environments, financial transactions, production deployments
Intent Integrity Checking
The LLM compares the agent’s statedintent field against the actual request payload.
Example: Intent Match
Example: Intent Mismatch
LLM Configuration
The risk assessor supports any OpenAI-compatible LLM API:Supported Providers
OpenAI
OpenAI
gpt-4o-mini (fast, cost-effective)Azure OpenAI
Azure OpenAI
Anthropic (via proxy)
Anthropic (via proxy)
Use a proxy that translates OpenAI format to Anthropic format, such as LiteLLM.
Local Models (Ollama/LM Studio)
Local Models (Ollama/LM Studio)
Request Parameters
The LLM API call uses these parameters (risk.service.ts:114):
Temperature 0 ensures deterministic, consistent risk scores. The LLM should not introduce randomness into security decisions.
Risk Assessment Flow
Risk assessment runs after URL validation but before idempotency check (proxy.service.ts:399):
Rationale: Risky requests are blocked before any expensive operations (credential decryption, API calls). This prevents resource exhaustion attacks.
Blocked Request Handling
When a request is blocked, the agent receives a 428 Precondition Required response:- Extract the
action_id - Poll
GET /status/:action_idevery 5-10 seconds - Wait for status to change from
PENDINGtoAPPROVEDorDENIED - If
APPROVED, callPOST /proxy/execute/:action_idto execute
Dashboard Review Context
Humans reviewing blocked requests in the dashboard see:- Agent name — which agent made the request
- Service name — target API being accessed
- Intent — agent’s stated purpose
- HTTP method — GET, POST, DELETE, etc.
- Target URL — full URL with path and query params
- Request headers — all headers except
AuthorizationandAgent-Key(stripped) - Request body — full payload (truncated to 500 chars in LLM prompt, but stored in full)
- Risk score — 0.0-1.0 final score
- Risk explanation — LLM’s one-sentence justification
- Timestamp — when request was blocked
Tuning Risk Assessment
Scenario: Too Many False Positives
Symptom: Legitimate requests are frequently blocked Solutions:- Increase
RISK_THRESHOLDfrom 0.5 to 0.6 or 0.7 - Improve agent’s
intentdescriptions (be more specific) - Review LLM model choice (some models are more conservative)
Scenario: Too Few Blocks
Symptom: Risky requests pass through without approval Solutions:- Decrease
RISK_THRESHOLDfrom 0.5 to 0.4 or 0.3 - Review method heuristics (consider custom weights per service)
- Add custom rules to LLM system prompt (see below)
Custom Risk Rules
You can extend the system prompt with service-specific rules. ModifyRISK_SYSTEM_PROMPT in risk.service.ts:33:
Logging and Monitoring
All risk assessments are logged atINFO level:
WARN level:
Related Concepts
Approval Flow
Learn what happens after a request is blocked
Security Model
Understand intent integrity in the trust model
Architecture
See where risk assessment fits in the request lifecycle