openclaw/openclaw · error · SsrFBlockedError
Invalid URL supplied to sandbox http/request
Error message
Invalid URL supplied to sandbox http/request
What it means
assertSandboxHttpRequestTargetAllowed wraps URL parsing in try/catch; if new URL(url) throws, the function throws SsrFBlockedError with this message. It is the first gate in the sandbox HTTP request path, run before protocol, hostname, or SSRF checks.
Source
Thrown at extensions/codex/src/app-server/sandbox-exec-server/http.ts:64
});
return result;
}
type SandboxHttpRequest = {
method: string;
url: string;
headers: HttpHeader[];
bodyBase64?: string;
timeoutMs?: number;
streamResponse: boolean;
};
function assertSandboxHttpRequestTargetAllowed(url: string): void {
let parsed: URL;
try {
parsed = new URL(url);
} catch {
throw new SsrFBlockedError("Invalid URL supplied to sandbox http/request");
}
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
throw new SsrFBlockedError(
`Blocked non-HTTP(S) protocol in sandbox http/request: ${parsed.protocol}`,
);
}
if (isBlockedHostnameOrIp(parsed.hostname)) {
throw new SsrFBlockedError(
`Blocked hostname or private/internal IP in sandbox http/request: ${parsed.hostname}`,
);
}
}
async function runSandboxHttpRequest(
execServer: OpenClawExecServer,
params: SandboxHttpRequest,
): Promise<JsonObject & { status: number; headers: HttpHeader[]; bodyBase64: string }> {
const backend = requireBackend(execServer);View on GitHub (pinned to 01804a7531)
Solutions
- Provide a fully-qualified URL including scheme, e.g. 'https://example.com/path'
- Validate with new URL(url) in your caller before issuing http/request
- Prepend 'https://' when the input lacks a scheme, then re-validate
Example fix
// before
await execServer.httpRequest({ url: 'api.example.com/v1', method: 'GET' });
// after
await execServer.httpRequest({ url: 'https://api.example.com/v1', method: 'GET' }); Defensive patterns
Strategy: validation
Validate before calling
function assertValidSandboxUrl(url: string): void {
try {
new URL(url);
} catch {
throw new Error('Invalid URL supplied to sandbox http/request');
}
} Type guard
function isParsableUrl(url: unknown): url is string {
if (typeof url !== 'string') return false;
try { new URL(url); return true; } catch { return false; }
} Try / catch
try {
await execServer.httpRequest({ url, method: 'GET' });
} catch (error) {
if (error instanceof Error && /Invalid URL/.test(error.message)) {
// prepend 'https://' and retry, or reject the input
} else throw error;
} Prevention
- Always include the scheme (http:// or https://) in URLs
- Pre-validate URLs with new URL() before issuing http/request
- Sanitize URL input from untrusted sources before dispatch
When it happens
Trigger: An http/request JSON-RPC call whose url field is not parseable as a URL: empty string, missing scheme, unbalanced brackets, stray characters, or a value that is technically a string but not a valid absolute URL (e.g. 'example.com', '://x', '[::1').
Common situations: Agent sending a bare hostname without scheme; URL built from untrusted text that failed sanitization; copy-paste that dropped 'https://'; template strings that left the scheme empty.
Related errors
- Blocked non-HTTP(S) protocol in sandbox http/request: ${pars
- Blocked hostname or private/internal IP in sandbox http/requ
- sandbox http/request failed with code ${result.code}
- Cannot copy directory without recursive=true: ${params.sourc
- Cannot recursively copy a directory into itself.
AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12).
Data as JSON: /api/errors/baf2db1f05087225.
Report an issue: GitHub.