utilhandler

package
v1.108.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package utilhandler implements the built-in "util" connection's in-process operations (issue #1005). The api gateway dispatches a connection configured with handler=internal to an http.Handler from this package instead of proxying to an upstream base_url; everything downstream of the dispatch (response buffering for api_invoke_endpoint, streaming to a portal asset for api_export, size and timeout caps, audit) is the gateway's normal machinery.

The first operation is fetch_url (POST /util/fetch): fetch an arbitrary public URL server-side, most importantly one-time signed download links (S3/GCS/Azure presigned URLs, report-generation links) whose host cannot be pre-registered as a connection.

Index

Constants

View Source
const FetchPath = "/util/fetch"

FetchPath is the catalog path of the fetch_url operation. The embedded OpenAPI spec, the mux route here, and the path callers pass to api_invoke_endpoint / api_export must all agree on this literal.

Variables

This section is empty.

Functions

func New

func New(opts Options) (http.Handler, error)

New builds the util operations handler the api gateway dispatches handler=internal connections to. The returned handler serves the operations the embedded catalog spec (SpecJSON) declares; the two are versioned together in this package so they cannot drift.

The outbound transport deliberately ignores proxy environment variables: an egress proxy sits inside the network perimeter, and routing guarded fetches through it would let the proxy reach destinations the dial guard just refused.

func SpecJSON

func SpecJSON() string

SpecJSON returns the embedded OpenAPI document for the util catalog.

Types

type Options

type Options struct {
	// AllowPrivateCIDRs lists prefixes exempted from the internal-range
	// SSRF block (apigateway.util_connection.allow_private_cidrs).
	// Empty means the default posture: public destinations open,
	// internal address space closed. An exemption grants ANY TCP port
	// on the listed range, so scope it to the specific host prefixes a
	// deployment must fetch from — a broad grant turns fetch_url into an
	// internal port-reach primitive.
	AllowPrivateCIDRs []string
}

Options configures the util handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL