Documentation
¶
Index ¶
- Constants
- func LoadConfigMaps(ctx context.Context, c client.Reader, templateName, namespace string) error
- func SecureTransport(base *http.Transport, policy Policy) *http.Transport
- func SetDenyFragment(fragment Policy)
- func SetEnhancer(fn PolicyEnhancer)
- func SetupWatcher(mgr manager.Manager, templateName, namespace string) error
- type Policy
- type PolicyEnhancer
Constants ¶
const ( // ConfigMapKeyDenyCIDRs is the ConfigMap data key for CIDR/IP denylist lines. ConfigMapKeyDenyCIDRs = "denyCIDRs" // ConfigMapKeyDenyHosts is the ConfigMap data key for hostname denylist lines. ConfigMapKeyDenyHosts = "denyHosts" )
const ( // ConfigTemplateLabel identifies the ConfigTemplate that produced a config. ConfigTemplateLabel = "config.oam.dev/type" // WorkflowHTTPDenyConfigTemplate is the vela-workflow chart ConfigTemplate // name and discovery label value (config.oam.dev/type). vela-core uses its // own prefixed default (vela-core-http-deny) so dual install has no shared // Helm-owned ConfigTemplate. WorkflowHTTPDenyConfigTemplate = "vela-workflow-http-deny" )
Variables ¶
This section is empty.
Functions ¶
func LoadConfigMaps ¶
LoadConfigMaps discovers ConfigMaps produced by templateName and atomically installs the union of all deny entries on top of BuiltinDeny. Zero discovered labeled ConfigMaps is allowed and leaves only the builtin floor in effect.
func SecureTransport ¶
SecureTransport returns a copy of base with dial-time SSRF validation applied. Every connection, including redirect follows, re-enters the dial hook.
func SetDenyFragment ¶
func SetDenyFragment(fragment Policy)
SetDenyFragment atomically replaces the denylist overlay.
func SetEnhancer ¶
func SetEnhancer(fn PolicyEnhancer)
SetEnhancer registers a hook applied on every Current() call.
Types ¶
type Policy ¶
type Policy struct {
// BlockPrivate denies RFC-1918 and RFC-4193 ULA ranges. Off by default
// because workflow HTTP steps legitimately call in-cluster ClusterIP services.
BlockPrivate bool
// BlockLoopback denies 127.0.0.0/8 and ::1. Off by default.
BlockLoopback bool
// DenyCIDRs blocks any destination IP contained in these networks.
DenyCIDRs []*net.IPNet
ExactIPs []net.IP
// ExactHosts are lower-case hostnames that must be rejected.
ExactHosts map[string]struct{}
// WildcardSuffixes are lower-case DNS suffixes without the leading "*."
// (for example "corp.internal" from "*.corp.internal").
WildcardSuffixes []string
}
Policy controls which destination hosts and IPs outbound HTTP clients may connect to. Host checks run on the URL before dial; IP checks run at dial time on the resolved address.
func BuiltinDeny ¶
func BuiltinDeny() Policy
BuiltinDeny returns a copy of the immutable denylist floor shipped with the binary. Cluster ConfigMaps can only add denies; they cannot remove these entries. Callers must not rely on mutating the returned Policy.
func Current ¶
func Current() Policy
Current returns DefaultPolicy, then enhancer, then the immutable builtin denylist floor, then any discovered ConfigMap deny overlay.
func DefaultPolicy ¶
func DefaultPolicy() Policy
DefaultPolicy returns the base outbound HTTP policy. Destination deny rules are supplied by discovered workflow HTTP deny ConfigMaps.
func ParseConfigMap ¶
ParseConfigMap builds a denylist Policy fragment from a ConfigMap.
func ParseDenyList ¶
ParseDenyList parses denyCIDRs and denyHosts text blobs into a Policy fragment that only carries denylist fields. Blank lines and # comments are ignored.
func (Policy) BlockedAddress ¶
BlockedAddress parses host:port from a dial address and reports whether it is blocked. Non-IP hosts are allowed through; host denylist must be checked separately via BlockedHost before dial.
func (Policy) BlockedHost ¶
BlockedHost reports whether hostname must be rejected under the denylist. Host may include a port; IP literals are checked against ExactIPs/DenyCIDRs.
type PolicyEnhancer ¶
PolicyEnhancer optionally mutates base policy (for example enabling BlockPrivate from a feature gate) before denylist merge.