Domain policy defaults to `null` → navigation/fetch fail-open (`continue`) until `setDomainPolicy`
Static review of public source at commit 4146eeaf1b3e. No traffic was sent to any Stagehand environment.
Browser contexts start with no domain policy, and the decision helper fail-opens when policy is null:
packages/extension/understudy/context.ts:
domainPolicy: NormalizedDomainPolicy | null = null;packages/extension/understudy/domainPolicy.ts:
export function getDomainPolicyDecision(
url: string,
policy: NormalizedDomainPolicy | null,
): DomainPolicyDecision {
if (!policy) return { action: "continue" };
...
}normalizeDomainPolicy also returns null when both allowedDomains and blockedDomains are empty. So unless the operator calls setDomainPolicy, agent-driven navigation can reach any host (including loopback / RFC1918 / metadata-style targets reachable from the browser machine). The policy machinery itself is solid (and #2945 tracks bypasses when a policy is set); the remaining gap is the insecure default for agentic browsing sessions, same class as browser-use's empty allow-list fail-open.
Suggested change (pick one, document it):
- Default local/agent profiles to a deny-by-default posture (require
allowedDomains, or block IP literals / private ranges) with an explicitallowAllDomains: trueescape hatch; or - Warn once when starting a context with
domainPolicy === null; or - Document prominently in quickstarts that production agents should call
setDomainPolicybefore navigation tools are exposed.
Severity: low–medium / defense-in-depth for agent browser sessions; policy is opt-in by design today. Distinct from #2945 (bypass when policy is set). No proof-of-concept.
Happy to send a focused PR if useful.
Source: browserbase/stagehand