Skip to content

Feature: SSRF protection needs a configurable whitelist for local services #27

@Kaspre

Description

@Kaspre

Summary

The built-in SSRF protection blocks all RFC 1918 private IPs, which makes it impossible to authorize requests to legitimate local services without disabling SSRF entirely.

Use Case

Running the sidecar on WSL2 with a local Ollama instance on the Windows host (172.30.192.1:11434). The host IP falls in the 172.16.0.0/12 range, so SSRF blocks it. The only upstream options are:

  1. Disable SSRF entirely (SsrfProtection::disabled()) — loses all protection
  2. Patch the source to add a whitelist — works but requires rebuilding for every change

A similar situation arises with any private-IP service: local databases, dev servers, other sidecars, etc.

Suggested Solution

Add a config-driven whitelist to SsrfProtection, either via:

  • A CLI flag: --ssrf-allow 172.30.192.1:11434,127.0.0.1:9200
  • A config file field: ssrf.allowed_endpoints = ["172.30.192.1:11434"]
  • An environment variable: PREDICATE_SSRF_ALLOW=172.30.192.1:11434

The whitelist should be host:port specific (not just IP) to limit the exemption surface.

Our Workaround

We patched src/ssrf.rs to add a whitelisted_endpoints: Vec<String> field that checks host:port against a hardcoded list before running IP-range checks. Works well but requires a rebuild to change.

Minor Additional Notes

A few other things we noticed while working with the SSRF module:

  • disabled() is fragile: Adding a new field to SsrfProtection requires updating disabled() manually (it doesn't derive from Default). Easy to miss.
  • Glob ** directory matching footgun: In policy patterns, model-eval/** does not match model-eval itself — only its contents. This is correct per glob spec but is a common mistake when writing fs.list rules. A note in the policy docs would help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions