kernl API
    Preparing search index...

    Function createHttpBridge

    • Creates the bridge that fetches web resources under an SSRF policy: allowed schemes only, no private or local destinations (checked again on every redirect hop and, when a resolver is supplied, after name resolution), a redirect cap, a time limit and a byte limit enforced on the streamed body.

      In a browser the hop check needs the redirect itself, which the fetch API hides: a redirect arrives as an opaque response and is refused with denied:redirect-unverifiable. Cross-origin rules still apply there; a request the browser blocks, or an opaque answer, is unavailable:network. On a server, redirects arrive as 3xx with a location and are followed.

      The fetch API cannot pin a connection to a validated address, so the resolver check narrows the DNS-rebinding window without closing it. kernl's shell wires no resolver today, so hostnames are judged as literals only.

      Parameters

      • options: HttpBridgeOptions = {}

        Policy overrides, a fetch implementation and an optional host resolver.

      Returns Bridge

      A bridge with id http labelled downloads.

      const bridge = createHttpBridge({
      resolveHost: async (host) => (await dns.promises.lookup(host, { all: true })).map((entry) => entry.address),
      });
      const result = await bridge.resolve(parseLocator('https://example.com/data.json'), { requester: 'shell' });