netguard

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package netguard is the HTTP transport for registry lookups. Image references come from the repository being scanned, which may not be yours (a pull request from a fork, a third-party project), so a reference must not be able to make the scanner call an address that is not a registry.

Link-local addresses, which include every cloud metadata service (169.254.169.254, fd00:ec2::254), are always refused: no registry lives there. With PublicOnly, loopback, private (RFC 1918), carrier-grade NAT, IPv6 unique-local and unspecified addresses are refused too, which is the setting for untrusted repositories. Addresses are checked after DNS on every connection, including redirects. With PublicOnly no proxy is used, so every connection is a checked direct dial: a proxy resolves names itself, and a name that resolves differently there (DNS rebinding) would escape the check. Without PublicOnly the environment's proxy is honoured and the target's addresses are checked before the request is handed to it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ip net.IP, publicOnly bool) error

Check returns an error when ip must not be contacted.

func Transport

func Transport(publicOnly bool) http.RoundTripper

Transport returns a guarded transport based on Go's default one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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