fix(policies): restrict http.send to remote endpoints in restrictive mode

Merged
MI
6d ago
+257-0

In restrictive mode, the Rego policy engine now limits http.send to plain remote HTTP(S) requests:

  • Requests that use TLS options that load certificates or keys from local files or environment variables (tls_ca_cert_file, tls_ca_cert_env_variable, tls_client_cert_file, tls_client_cert_env_variable, tls_client_key_file, tls_client_key_env_variable) are rejected. Inline TLS material (tls_ca_cert, tls_client_cert, tls_client_key) is still accepted.
  • Requests whose URL scheme is not http or https are rejected.

The check runs on the request object at evaluation time, so it also covers requests built dynamically. It applies to both the CLI and the control plane.

OPA resolves built-ins from a process-wide registry, so http.send is wrapped there. The wrapper fails closed: any OPA evaluation in a binary that imports this package gets the restriction, unless it runs through an Engine in permissive mode, which is unchanged.

Tested with table-driven tests that cover each option, keys built at runtime, the URL scheme, the matches_parameters path, and permissive mode.

This change was produced with AI assistance (Claude Code).

🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri using the eng-autopilot skill