Skip to content

Input Guardrails: SSRF, DLP, Injection, Files 🟑 BETA

Distinguish the guards that are wired into a request path from the validators that exist only as a library, then verify the wired ones.

Admin guide Β· input guardrail runbook

When to use Before you start Steps Verify Roll back
Reviewing an untrusted-input path, after a guard change Source checkout, running server Find the consumer, probe the guard Refusal observed in the live path Restore the previous guard source

When to use

Use this runbook before claiming that a guard protects a feature. A validator with no caller outside its own crate is not a protection; say so instead of documenting a switch that does nothing.

Before you start

  • SSRF code lives in botserver/crates/botsecurity-core/src/validation/ (ssrf_guard.rs, validate_url_ssrf.rs, ssrf_fetch.rs, plus ssrf_allowlist). The wired guard and the library validator are different things: find the caller.
  • File-upload validation and the malware scanner are in botsecurity-protection and the server's run_axum_server_malware_scanner.rs; ClamAV is pinned in botserver/3rdparty.toml.
  • Browser-page budgets are in botbrowserpolicy (see browser policy); per-request throughput is in system limits.
  • The code contracts from the repository AGENTS.md apply here too: sql_guard for identifiers, SafeCommand for commands, log_and_sanitize for errors.

Steps

# 1. Find consumers of each guard outside its own crate.
grep -RIn "validate_url_ssrf\|ssrf_guard\|ssrf_fetch" botserver/src botserver/crates \
  --include='*.rs' | grep -v "botsecurity-core/src/validation" | head -30

# 2. Find the upload validator's caller.
grep -RIn "malware_scanner\|validate_upload\|upload_validation" botserver/src botserver/crates \
  --include='*.rs' | head -30

# 3. Probe a caller-supplied URL through the real feature, not a unit test.
#    An address that resolves to a loopback or private target must be refused.
grep -E "SSRF|WARN|ERROR" botserver.log | tail -30

# 4. Exercise the self-tests for the pure validators.
cargo test -p botsecurity-core --lib

Verify

Guard Evidence Pass condition
SSRF (wired) caller grep plus live probe a blocked target is refused in the feature
SSRF (library) validate_url_ssrf tests unit tests pass; documented as library-only if no caller
Uploads scanner caller grep every upload path passes the validator
Injection sql_guard in handlers identifiers sanitised, no formatted SQL
Errors log_and_sanitize no raw error returned to the client
Budgets browser policy browser task stops at its limit

Roll back

πŸ”΄ Restore the previous guard source through version control and redeploy with the deploy runbook. If a guard was disabled during an incident, re-enable it only after the verification table passes; record the exception in incident response.