Skip to content

Endpoint Rules

Endpoint rules add method/path controls on top of domain allowlists.

from isorun import Sandbox
with Sandbox("python", network={
"rules": [
{"host": "api.openai.com", "method": "POST", "path": "/v1/chat/completions"},
{"host": "api.openai.com", "method": "GET", "path": "/v1/models"},
],
"deny": ["0.0.0.0/0"],
}) as sb:
sb.exec("python3 call_openai.py")

Rule fields

FieldRequiredDescription
hostYesDomain pattern, supports wildcards (*.github.com)
methodNoHTTP method (GET, POST, PUT, PATCH, DELETE)
pathNoPath prefix or glob (/repos/myorg/*)

Common policies

Read-only GitHub access

rules = [
{"host": "github.com", "method": "GET", "path": "/*"},
{"host": "api.github.com", "method": "GET", "path": "/repos/*"},
]

LLM inference only

rules = [
{"host": "api.openai.com", "method": "POST", "path": "/v1/chat/completions"},
{"host": "api.openai.com", "method": "GET", "path": "/v1/models"},
]

Combination model

A request must pass both filters:

  1. Host allow/deny policy (network profile or custom allowlist)
  2. Endpoint rule match (if rules are configured)

Use this with Network Profiles for reusable policy baselines.