v1alpha1

package
v0.7.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package v1alpha1 holds the Inkwall Kubernetes API (group waf.inkwall.dev): the cluster configuration, the policies app teams attach to their routes, and the rule sets those policies use. Design: docs/design/0002 §4.2 and docs/design/0004 §3.

+kubebuilder:object:generate=true +groupName=waf.inkwall.dev

Index

Constants

View Source
const (
	// ConditionAccepted is True when the spec is valid and its references
	// resolve.
	ConditionAccepted = "Accepted"
	// ConditionProgrammed is True when every targeted route's proxy sends
	// traffic to Inkwall.
	ConditionProgrammed = "Programmed"
	// ConditionEnforced is True when every engine serving the targets has
	// applied a bundle containing the current generation.
	ConditionEnforced = "Enforced"
	// ConditionReady is True when Accepted, Programmed and Enforced are.
	ConditionReady = "Ready"
	// ConditionControlPlaneConnected, on the InkwallConfig, says whether the
	// cluster is enrolled and connected to the optional control plane
	// (GitOps and Managed mode only).
	ConditionControlPlaneConnected = "ControlPlaneConnected"
	// ConditionSuspended, on the InkwallConfig, is True while the published
	// bundle suspends inspection (spec.suspend): every engine allows every
	// request.
	ConditionSuspended = "Suspended"
	// ConditionSigningKeyRotation, on the InkwallConfig, is True while a
	// bundle signing key rotation is in progress; its message says what the
	// rotation waits for.
	ConditionSigningKeyRotation = "SigningKeyRotation"
	// ConditionIntegrationsConfigured, on the InkwallConfig, is False when
	// spec.integrations can't be applied (an invalid selector), with why.
	ConditionIntegrationsConfigured = "IntegrationsConfigured"
	// ConditionEngineRollout, on the InkwallConfig, is True while the
	// operator replaces proxy pods for a new engine (spec.engine.rollout:
	// Automatic), and False when it has nothing to replace, is paused
	// (reason Paused, saying why) or the rollout is Manual.
	ConditionEngineRollout = "EngineRollout"
	// ConditionEngineConfigured, on the InkwallConfig, is False when the
	// engine pinned in spec.engine.image is injected without some
	// spec.engine settings, because its release (or a custom build) may
	// not know their flags; the message names them.
	ConditionEngineConfigured = "EngineConfigured"
	// ConditionEventsExported, on the InkwallConfig, says whether every
	// sink of spec.events.export exports from every operator replica;
	// absent without sinks.
	ConditionEventsExported = "EventsExported"
	// ConditionGeoDatabaseReady, on the InkwallConfig, says whether the
	// country database (spec.geo.database) is compiled and published;
	// absent without spec.geo.
	ConditionGeoDatabaseReady = "GeoDatabaseReady"
)

Condition types. Every WAFPolicy reports Accepted, Programmed, Enforced and Ready (0004 §3.2); WAFRuleSets, ClusterWAFRuleSets and WAFIPLists report Accepted; the InkwallConfig reports the conditions below that name it.

View Source
const (
	SourceLabel = "inkwall.dev/source"
	SourceSaaS  = "saas"
)

SourceLabel says where a WAFPolicy, WAFRuleSet, ClusterWAFRuleSet or WAFIPList comes from. In Managed mode the operator writes the control plane's policies labelled SourceSaaS (0004 §4.9), and the validating webhook lets no one else create, change or delete them, or add or remove the label.

View Source
const RotateSigningKeyAnnotation = "waf.inkwall.dev/rotate-signing-key"

RotateSigningKeyAnnotation on the InkwallConfig requests a rotation of the bundle signing key: each new value starts one (a timestamp, say). The operator publishes a new key to the engines, switches to it once every connected engine trusts it, and retires the old key once every engine runs a bundle signed with the new one. A request made during a rotation starts another one after it.

Variables

View Source
var (
	// GroupVersion is the API group and version of these types.
	GroupVersion = schema.GroupVersion{Group: "waf.inkwall.dev", Version: "v1alpha1"}

	// SchemeBuilder registers the types with a runtime.Scheme.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

	// AddToScheme adds the types to a runtime.Scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type AdapterKind

type AdapterKind string

AdapterKind is how a proxy hands requests to the engine (0006). Only IntegrationSpec's deprecated Adapter uses it: the operator takes each integration's adapter from its built-in table, and ExtAuthz, LuaPlugin, AuthURL and Module have no implementation. The enum stays so that InkwallConfigs that set the field remain valid; v1 drops it. +kubebuilder:validation:Enum=ExtProc;ExtAuthz;LuaPlugin;AuthURL;ForwardAuth;SPOE;Module

const (
	AdapterExtProc     AdapterKind = "ExtProc"
	AdapterExtAuthz    AdapterKind = "ExtAuthz"
	AdapterLuaPlugin   AdapterKind = "LuaPlugin"
	AdapterAuthURL     AdapterKind = "AuthURL"
	AdapterForwardAuth AdapterKind = "ForwardAuth"
	AdapterSPOE        AdapterKind = "SPOE"
	AdapterModule      AdapterKind = "Module"
)

The adapter kinds.

type ArgumentPattern added in v0.5.0

type ArgumentPattern string

ArgumentPattern is part of an argument name, as WAFPolicy exclusions name arguments. +kubebuilder:validation:MinLength=1 +kubebuilder:validation:MaxLength=256 +kubebuilder:validation:Pattern=`^[A-Za-z0-9_.\-\[\]]+$`

type BodySpec

type BodySpec struct {
	// Inspect turns body inspection on or off.
	// +kubebuilder:default=true
	// +optional
	Inspect *bool `json:"inspect,omitempty"`

	// MaxBytes is how much of a body is inspected, at most 10 MiB. Unset:
	// the engine's --max-body-bytes (64 KiB unless an engine outside the
	// operator's wiring sets it), a default that doesn't change within v1.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=10485760
	// +optional
	MaxBytes *int64 `json:"maxBytes,omitempty"`

	// OnOversize is what happens to a body over maxBytes: Deny (413 in
	// Block mode) or Allow (forwarded uninspected, and logged). Unset: Deny
	// in Block mode, Allow in Detect mode.
	// +optional
	OnOversize OversizeAction `json:"onOversize,omitempty"`

	// GRPCMessages decides whether the text in gRPC calls' messages is
	// inspected: Inspect reads each protobuf message without its schema
	// and gives its text fields to the rules as form arguments; a message
	// that can't be read (cut at maxBytes, compressed other than with
	// gzip, not protobuf) is handled by onOversize. Unset: Skip, only the
	// call's path and metadata are inspected. See docs/grpc.md.
	// +optional
	GRPCMessages GRPCMessagesAction `json:"grpcMessages,omitempty"`

	// GRPCStreams decides how the messages are read, with grpcMessages:
	// Inspect. PerMessage inspects each message on its own as it comes,
	// up to maxBytes each, so long client streams and bidirectional calls
	// work; the messages before a denied one have already reached the
	// application. Through Envoy Gateway and Istio; other proxies buffer
	// the body as with Buffer. Unset: Buffer, the body the proxy buffers,
	// up to maxBytes in all. Requires engines 0.6.0 or later. See
	// docs/grpc.md.
	// +optional
	GRPCStreams GRPCStreamsMode `json:"grpcStreams,omitempty"`

	// GRPCSchema reads the messages of the methods it describes with their
	// schema, with grpcMessages: Inspect: fields by their type and named by
	// their path (user.name), string fields as text, bytes fields by their
	// readable runs, numbers skipped. Methods and fields it doesn't
	// describe are read without it. Requires engines 0.7.0 or later: older
	// ones read every message without it. See docs/grpc.md.
	// +optional
	GRPCSchema *GRPCSchema `json:"grpcSchema,omitempty"`

	// GRPC: Deny refuses requests with a gRPC or gRPC-Web content type
	// (403, or the gRPC status PermissionDenied to a gRPC client; logged in
	// Detect mode), for routes that serve no gRPC. Unset: Allow. Requires
	// engines 0.5.0 or later. See docs/grpc.md.
	// +optional
	GRPC GRPCAction `json:"grpc,omitempty"`
}

BodySpec configures request body inspection. +kubebuilder:validation:XValidation:rule="!has(self.grpcStreams) || self.grpcStreams != 'PerMessage' || (has(self.grpcMessages) && self.grpcMessages == 'Inspect' && (!has(self.inspect) || self.inspect))",message="grpcStreams: PerMessage needs grpcMessages: Inspect and body inspection" +kubebuilder:validation:XValidation:rule="!has(self.grpcSchema) || (has(self.grpcMessages) && self.grpcMessages == 'Inspect')",message="grpcSchema needs grpcMessages: Inspect"

func (*BodySpec) DeepCopy

func (in *BodySpec) DeepCopy() *BodySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BodySpec.

func (*BodySpec) DeepCopyInto

func (in *BodySpec) DeepCopyInto(out *BodySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BootstrapMode

type BootstrapMode string

BootstrapMode is what an engine does with requests before it has a policy bundle (0004 §4.6). +kubebuilder:validation:Enum=AllowAll;DenyAll

const (
	// BootstrapAllowAll lets requests through uninspected: availability
	// first.
	BootstrapAllowAll BootstrapMode = "AllowAll"
	// BootstrapDenyAll rejects them with 503.
	BootstrapDenyAll BootstrapMode = "DenyAll"
)

The bootstrap modes.

type BuiltinRuleSet

type BuiltinRuleSet string

BuiltinRuleSet names a rule set shipped inside the engine image, pinned to the engine's version. +kubebuilder:validation:Enum=crs-v4

const BuiltinCRSv4 BuiltinRuleSet = "crs-v4"

BuiltinCRSv4 is the OWASP Core Rule Set v4.

type BundleSpec added in v0.4.6

type BundleSpec struct {
	// NamespaceShare is the share of each of the bundle's size limits
	// (7,200 KiB compressed, 64 MiB raw), in percent, that one namespace
	// may grow to while the bundle with every change would leave less than
	// that share of a limit free: then a namespace's changes that grow its
	// share, measured, past it are held back (Accepted=False,
	// BundleTooLarge). It never applies when one namespace has all the
	// content, or to a first bundle that fits. A namespace's share is what
	// the bundle would save without its policies and rule sets;
	// ClusterWAFRuleSets, such as the CRS, are in nobody's share. A
	// compressed share not measured (many namespaces changed at once) is
	// within it. Content already published is never taken out. 0 is 25.
	// +kubebuilder:validation:Minimum=5
	// +kubebuilder:validation:Maximum=100
	// +kubebuilder:default=25
	// +optional
	NamespaceShare int32 `json:"namespaceShare,omitempty"`

	// ClusterReserve is the share of each of the bundle's size limits, in
	// percent, kept free for ClusterWAFRuleSet changes, such as a CRS
	// upgrade: namespaces' changes that grow the bundle are held back
	// (Accepted=False, BundleTooLarge) when the bundle after them would
	// leave less than it free; cluster rule set changes may use it, and so
	// may a namespace's change that adopts one (a fix shipped with a CRS
	// upgrade that adds a rule id its published rules use). It never applies
	// when one namespace has all the content, to a first bundle, or to the
	// bundle in force published again when even holding every change doesn't
	// fit. 0 turns it off.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=50
	// +kubebuilder:default=10
	// +optional
	ClusterReserve *int32 `json:"clusterReserve,omitempty"`
}

BundleSpec configures the policy bundle.

func (*BundleSpec) DeepCopy added in v0.4.6

func (in *BundleSpec) DeepCopy() *BundleSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleSpec.

func (*BundleSpec) DeepCopyInto added in v0.4.6

func (in *BundleSpec) DeepCopyInto(out *BundleSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BundleStatus added in v0.5.0

type BundleStatus struct {
	// Version of the bundle published.
	Version int64 `json:"version"`

	// CompressedBytes is its size as stored, gzip-compressed.
	CompressedBytes int64 `json:"compressedBytes"`

	// LimitBytes is the largest bundle that can be published: past it,
	// policy changes aren't published (BundleTooLarge).
	LimitBytes int64 `json:"limitBytes"`
}

BundleStatus describes the published bundle.

func (*BundleStatus) DeepCopy added in v0.5.0

func (in *BundleStatus) DeepCopy() *BundleStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleStatus.

func (*BundleStatus) DeepCopyInto added in v0.5.0

func (in *BundleStatus) DeepCopyInto(out *BundleStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CIDR added in v0.5.0

type CIDR string

CIDR is an IPv4 or IPv6 prefix (10.0.0.0/8) or address. +kubebuilder:validation:MinLength=2 +kubebuilder:validation:MaxLength=49 +kubebuilder:validation:Pattern=`^[0-9A-Fa-f.:]+(/[0-9]{1,3})?$`

type CRSSettings added in v0.5.0

type CRSSettings struct {
	// ParanoiaLevel is the OWASP CRS paranoia level, 1 to 4: the rules up
	// to this level can block. Unset: 1.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=4
	// +optional
	ParanoiaLevel *int32 `json:"paranoiaLevel,omitempty"`

	// InboundAnomalyThreshold is the request anomaly score at which a
	// request is flagged (blocked in Block mode). Unset: 5.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=10000
	// +optional
	InboundAnomalyThreshold *int32 `json:"inboundAnomalyThreshold,omitempty"`

	// AllowedMethods replaces the request methods the CRS allows (GET, HEAD,
	// POST and OPTIONS by default; rule 911100). List every method the
	// application serves, for example PUT, PATCH and DELETE for a REST API.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=64
	// +listType=set
	// +optional
	AllowedMethods []HTTPMethodToken `json:"allowedMethods,omitempty"`

	// AllowedRequestContentTypes replaces the request media types the CRS
	// allows (rule 920420), as type/subtype without parameters, for example
	// application/json. Compared case-insensitively.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=64
	// +listType=set
	// +optional
	AllowedRequestContentTypes []MediaType `json:"allowedRequestContentTypes,omitempty"`

	// DetectionParanoiaLevel runs the rules above paranoiaLevel, up to this
	// level, without blocking: a request they would have blocked is
	// logged. From paranoiaLevel to 4.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=4
	// +optional
	DetectionParanoiaLevel *int32 `json:"detectionParanoiaLevel,omitempty"`

	// OutboundAnomalyThreshold is the response anomaly score at which a
	// response is blocked (the CRS's default is 4). Only used when the
	// policy inspects responses.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=10000
	// +optional
	OutboundAnomalyThreshold *int32 `json:"outboundAnomalyThreshold,omitempty"`
}

CRSSettings are OWASP CRS settings (its tx variables), applied to each request before the CRS's defaults. Unset fields keep the CRS's defaults.

func (*CRSSettings) DeepCopy added in v0.5.0

func (in *CRSSettings) DeepCopy() *CRSSettings

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CRSSettings.

func (*CRSSettings) DeepCopyInto added in v0.5.0

func (in *CRSSettings) DeepCopyInto(out *CRSSettings)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CRSSettings) NeedsEngine050

func (s *CRSSettings) NeedsEngine050() bool

NeedsEngine050 reports whether s sets any of the settings that need engines 0.5.0 or later (s may be nil): its paranoiaLevel and inboundAnomalyThreshold, which every engine applies, don't count.

type ClientIPKey

type ClientIPKey struct {
	// IPv6PrefixLength counts IPv6 clients by this prefix, 32 to 128;
	// IPv4 clients by their address. Unset: 56.
	// +kubebuilder:validation:Minimum=32
	// +kubebuilder:validation:Maximum=128
	// +optional
	IPv6PrefixLength *int32 `json:"ipv6PrefixLength,omitempty"`
}

ClientIPKey counts by the client address.

func (*ClientIPKey) DeepCopy

func (in *ClientIPKey) DeepCopy() *ClientIPKey

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientIPKey.

func (*ClientIPKey) DeepCopyInto

func (in *ClientIPKey) DeepCopyInto(out *ClientIPKey)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClientIPSpec added in v0.5.0

type ClientIPSpec struct {
	// TrustedProxies are the addresses or CIDR prefixes of proxies in front
	// of the proxy the engine runs beside (load balancers) whose
	// X-Forwarded-For entries are trusted. The loopback is always trusted.
	// +kubebuilder:validation:MaxItems=32
	// +listType=set
	// +optional
	TrustedProxies []CIDR `json:"trustedProxies,omitempty"`

	// TrustedHops is how many X-Forwarded-For entries, from the right and
	// after those the proxy beside the engine added, are proxies whatever
	// their address: for load balancers without fixed addresses. 0: none.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=10
	// +optional
	TrustedHops *int32 `json:"trustedHops,omitempty"`
}

ClientIPSpec configures how engines find the client's address.

func (*ClientIPSpec) DeepCopy added in v0.5.0

func (in *ClientIPSpec) DeepCopy() *ClientIPSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientIPSpec.

func (*ClientIPSpec) DeepCopyInto added in v0.5.0

func (in *ClientIPSpec) DeepCopyInto(out *ClientIPSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterMode

type ClusterMode string

ClusterMode is where a cluster's policy comes from (0002 §4.1). +kubebuilder:validation:Enum=Standalone;GitOps;Managed

const (
	// ModeStandalone takes policy from the CRDs, with no control plane.
	ModeStandalone ClusterMode = "Standalone"
	// ModeGitOps takes policy from the CRDs and mirrors it, read-only, to
	// the control plane.
	ModeGitOps ClusterMode = "GitOps"
	// ModeManaged takes policy from the control plane, which the operator
	// writes as CRDs; edits by anyone else are rejected.
	ModeManaged ClusterMode = "Managed"
)

type ClusterRuleSetSource

type ClusterRuleSetSource struct {
	// Builtin is a rule set shipped in the engine image.
	// +optional
	Builtin BuiltinRuleSet `json:"builtin,omitempty"`

	// SecLang holds the rules inline, at most 256 KiB.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=262144
	// +optional
	SecLang string `json:"seclang,omitempty"`

	// ConfigMapRef reads the rules from a ConfigMap.
	// +optional
	ConfigMapRef *NamespacedConfigMapKeyRef `json:"configMapRef,omitempty"`
}

ClusterRuleSetSource is where a ClusterWAFRuleSet's rules come from: exactly one of builtin, seclang or configMapRef. +kubebuilder:validation:XValidation:rule="[has(self.builtin), has(self.seclang), has(self.configMapRef)].filter(x, x).size() == 1",message="set exactly one of builtin, seclang or configMapRef"

func (*ClusterRuleSetSource) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRuleSetSource.

func (*ClusterRuleSetSource) DeepCopyInto

func (in *ClusterRuleSetSource) DeepCopyInto(out *ClusterRuleSetSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterWAFRuleSet

type ClusterWAFRuleSet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec ClusterWAFRuleSetSpec `json:"spec"`
	// +optional
	Status RuleSetStatus `json:"status,omitempty"`
}

ClusterWAFRuleSet is a set of rules that policies in any namespace can use.

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=inkwall,shortName=cwafrs +kubebuilder:printcolumn:name="Builtin",type=string,JSONPath=`.spec.source.builtin` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*ClusterWAFRuleSet) DeepCopy

func (in *ClusterWAFRuleSet) DeepCopy() *ClusterWAFRuleSet

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterWAFRuleSet.

func (*ClusterWAFRuleSet) DeepCopyInto

func (in *ClusterWAFRuleSet) DeepCopyInto(out *ClusterWAFRuleSet)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterWAFRuleSet) DeepCopyObject

func (in *ClusterWAFRuleSet) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ClusterWAFRuleSetList

type ClusterWAFRuleSetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ClusterWAFRuleSet `json:"items"`
}

ClusterWAFRuleSetList is a list of ClusterWAFRuleSet.

+kubebuilder:object:root=true

func (*ClusterWAFRuleSetList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterWAFRuleSetList.

func (*ClusterWAFRuleSetList) DeepCopyInto

func (in *ClusterWAFRuleSetList) DeepCopyInto(out *ClusterWAFRuleSetList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterWAFRuleSetList) DeepCopyObject

func (in *ClusterWAFRuleSetList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ClusterWAFRuleSetSpec

type ClusterWAFRuleSetSpec struct {
	// Source of the rules.
	Source ClusterRuleSetSource `json:"source"`
}

ClusterWAFRuleSetSpec defines a cluster-wide rule set.

func (*ClusterWAFRuleSetSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterWAFRuleSetSpec.

func (*ClusterWAFRuleSetSpec) DeepCopyInto

func (in *ClusterWAFRuleSetSpec) DeepCopyInto(out *ClusterWAFRuleSetSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConfigMapKeyRef

type ConfigMapKeyRef struct {
	// Name of the ConfigMap.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	Name string `json:"name"`

	// Key holding the SecLang rules (a rule set's) or the descriptor set (a
	// policy's grpcSchema).
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	Key string `json:"key"`
}

ConfigMapKeyRef names a key of a ConfigMap in the namespace of the object that refers to it.

func (*ConfigMapKeyRef) DeepCopy

func (in *ConfigMapKeyRef) DeepCopy() *ConfigMapKeyRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapKeyRef.

func (*ConfigMapKeyRef) DeepCopyInto

func (in *ConfigMapKeyRef) DeepCopyInto(out *ConfigMapKeyRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ControlPlane

type ControlPlane struct {
	// Endpoint is the control plane's gRPC address, as grpcs://host:port.
	// +kubebuilder:validation:Pattern=`^grpcs://[^/\s]+$`
	// +kubebuilder:validation:MaxLength=512
	Endpoint string `json:"endpoint"`

	// EnrollmentSecretRef is the Secret holding the enrollment token, in
	// the operator's namespace (its namespace can be left out).
	EnrollmentSecretRef SecretReference `json:"enrollmentSecretRef"`
}

ControlPlane is the connection to the optional control plane.

func (*ControlPlane) DeepCopy

func (in *ControlPlane) DeepCopy() *ControlPlane

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlane.

func (*ControlPlane) DeepCopyInto

func (in *ControlPlane) DeepCopyInto(out *ControlPlane)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CountryCode

type CountryCode string

CountryCode is an ISO 3166-1 alpha-2 country code, upper case: DE, US. Codes the databases use that aren't officially assigned, such as XK (Kosovo), are accepted; the webhook warns on others. +kubebuilder:validation:Pattern=`^[A-Z]{2}$`

type DenialFormat

type DenialFormat string

DenialFormat is the body of an engine's denials. +kubebuilder:validation:Enum=Text;JSON

const (
	// DenialText answers every denied client with plain text.
	DenialText DenialFormat = "Text"
	// DenialJSON answers a denied client that accepts application/json
	// with a JSON body, and any other client with text.
	DenialJSON DenialFormat = "JSON"
)

The denial formats.

type DenyResponse

type DenyResponse struct {
	// ContentType is the body's media type: text/html, text/plain,
	// application/json or application/problem+json, optionally with
	// "; charset=utf-8" (the body is UTF-8 either way).
	// +kubebuilder:validation:MaxLength=64
	// +kubebuilder:validation:XValidation:rule="self.lowerAscii().matches('^(text/html|text/plain|application/json|application/problem[+]json)( *; *charset=utf-8)?$')",message="contentType must be text/html, text/plain, application/json or application/problem+json, optionally with ; charset=utf-8"
	ContentType string `json:"contentType"`

	// Body is the denial's body, at most 8 KiB of UTF-8. Each
	// {{request_id}} in it is replaced with the request's ID. With a JSON
	// content type, it must be a JSON document.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=8192
	// +kubebuilder:validation:XValidation:rule="size(bytes(self)) <= 8192",message="body must be at most 8 KiB (8192 bytes of UTF-8)"
	Body string `json:"body"`
}

DenyResponse is the body a denied client gets instead of the engine's own (docs/denial-responses.md): an HTML page or a JSON document, served with the denial's status (403, 429 with Retry-After, 503, ...) and X-Request-Id, which it can't change. The only substitution is {{request_id}}, replaced with the request's ID, escaped for the content type: nothing else of the request goes in. A denied gRPC call still gets its gRPC status and no body.

func (*DenyResponse) DeepCopy

func (in *DenyResponse) DeepCopy() *DenyResponse

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DenyResponse.

func (*DenyResponse) DeepCopyInto

func (in *DenyResponse) DeepCopyInto(out *DenyResponse)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type EngineCounts added in v0.5.0

type EngineCounts struct {
	// Connected engines.
	Connected int32 `json:"connected"`

	// Current engines run the published bundle.
	Current int32 `json:"current"`

	// Behind engines run an older bundle, and haven't rejected the
	// published one.
	Behind int32 `json:"behind"`

	// Rejected engines rejected the published bundle.
	Rejected int32 `json:"rejected"`

	// Outdated engines are too old for a field some policy sets, which they
	// ignore (EnginesOutdated).
	Outdated int32 `json:"outdated"`
}

EngineCounts counts the connected engines, as of the replicas' latest engine reports.

func (*EngineCounts) DeepCopy added in v0.5.0

func (in *EngineCounts) DeepCopy() *EngineCounts

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EngineCounts.

func (*EngineCounts) DeepCopyInto added in v0.5.0

func (in *EngineCounts) DeepCopyInto(out *EngineCounts)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type EngineSpec

type EngineSpec struct {
	// Image is the engine image. Empty means the image released with this
	// operator version. An image whose tag is an older release (0.4.1) is
	// injected without the settings below that release doesn't know, and
	// one whose tag isn't a release (latest, a digest alone) without any
	// setting some release doesn't know, so it starts: the EngineConfigured
	// condition names them.
	// +kubebuilder:validation:MaxLength=512
	// +optional
	Image string `json:"image,omitempty"`

	// Resources of the engine container. Setting no CPU limit is
	// recommended: CPU throttling shows up as tail latency on every request.
	// +optional
	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

	// SocketDir is ignored: each integration places the engine's socket
	// itself (Envoy Gateway's in /var/run/inkwall-socket; Traefik reaches
	// the engine over loopback TCP). It stays so that InkwallConfigs that
	// set it remain valid; setting it draws a warning.
	//
	// Deprecated: remove it from the InkwallConfig.
	//
	// +kubebuilder:validation:MaxLength=64
	// +optional
	SocketDir string `json:"socketDir,omitempty"`

	// BootstrapMode is what a new engine does with requests when it has no
	// bundle yet: no cached bundle, the bundle Secret unreadable and the
	// operator unreachable. It waits up to 10 seconds for one before its
	// proxy takes traffic, then allows (AllowAll) or rejects (DenyAll) the
	// requests until a bundle arrives. Applies to pods injected from then
	// on.
	// +kubebuilder:default=AllowAll
	// +optional
	BootstrapMode BootstrapMode `json:"bootstrapMode,omitempty"`

	// LogLevel is the engines' log level: Debug, Info, Warn or Error.
	// Security events are logged at Warn, so Error hides them (they still
	// go to the operator). Unset: the engine's default, Info. Applies to
	// pods injected from then on.
	// +optional
	LogLevel LogLevel `json:"logLevel,omitempty"`

	// Rollout is how proxy pods that need a new engine (none: started
	// before Inkwall; or another image than the one configured) get one.
	// Manual: they are reported (PendingRestart) and you restart them.
	// Automatic: the operator evicts them one at a time through the
	// Eviction API, which respects PodDisruptionBudgets, waiting for each
	// replacement to be ready and run the current bundle before the next;
	// it pauses, and says why on the InkwallConfig (EngineRollout), when an
	// eviction is refused or a replacement isn't ready in time. Pods the
	// Pod webhook injects only (Traefik, HAProxy, Istio's ingress gateways):
	// Envoy Gateway and Istio's Gateway API deployments roll their pods
	// themselves.
	// +kubebuilder:default=Manual
	// +optional
	Rollout RolloutPolicy `json:"rollout,omitempty"`

	// PolicyMetrics adds inkwall_policy_requests_total, the engines'
	// requests by policy, for up to 500 policies per engine (the rest count
	// as policy="other"). Off by default: one series per policy, action and
	// reason. Applies to pods injected from then on.
	// +optional
	PolicyMetrics bool `json:"policyMetrics,omitempty"`

	// DenialFormat is the body of the engines' denials. Text: plain text.
	// JSON: a client that accepts application/json gets a JSON body,
	// {"error":"forbidden","status":403,"request_id":...}, and any other
	// client text. Every denial carries X-Request-Id either way. Through
	// Traefik, Envoy Gateway and Istio; HAProxy writes its own denials.
	// Unset: Text, or JSON when the deprecated jsonDenials is true. Applies
	// to pods injected from then on. JSON requires engines 0.5.0 or later.
	// +optional
	DenialFormat DenialFormat `json:"denialFormat,omitempty"`

	// JSONDenials true means denialFormat: JSON, which takes its place. It
	// stays so that InkwallConfigs that set it remain valid; setting or
	// changing it draws a warning, and v1 removes it. It can't be true
	// with denialFormat: Text.
	//
	// Deprecated: use denialFormat.
	//
	// +optional
	JSONDenials bool `json:"jsonDenials,omitempty"`

	// DenyResponse is the body of the denials of every WAFPolicy that sets
	// no spec.denyResponse, instead of the engine's own (denialFormat's).
	// It goes in the bundle, so it applies without restarting a pod.
	// Requires engines 0.7.0 or later; older ones ignore it.
	// +optional
	DenyResponse *DenyResponse `json:"denyResponse,omitempty"`

	// RateLimitKeys is the rate limit buckets each engine holds at once,
	// for every policy's spec.rateLimits: about 48 bytes each, allocated
	// with the first bundle that has limits, and at most a quarter of the
	// engine's memory limit. When the table is full, the buckets closest
	// to full are forgotten (inkwall_rate_limit_evictions_total{kind="active"}).
	// Unset: 262,144 (about 12 MiB). Applies to pods injected from then
	// on. Requires engines 0.7.0 or later.
	// +kubebuilder:validation:Minimum=1024
	// +kubebuilder:validation:Maximum=16777216
	// +optional
	RateLimitKeys *int32 `json:"rateLimitKeys,omitempty"`

	// ClientIP configures which forwarding headers the engines trust for
	// the client's address, behind an HTTP load balancer that appends it to
	// X-Forwarded-For. Unset: only the proxy beside the engine is trusted.
	// A wrong setting lets clients choose their address: see
	// docs/client-ip.md. Applies to pods injected from then on (Envoy
	// Gateway rolls its pods itself).
	// +optional
	ClientIP *ClientIPSpec `json:"clientIP,omitempty"`
}

EngineSpec configures the engine sidecars. +kubebuilder:validation:XValidation:rule="!(has(self.jsonDenials) && self.jsonDenials && has(self.denialFormat) && self.denialFormat == 'Text')",message="jsonDenials: true contradicts denialFormat: Text; remove jsonDenials, which is deprecated"

func (*EngineSpec) DeepCopy

func (in *EngineSpec) DeepCopy() *EngineSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EngineSpec.

func (*EngineSpec) DeepCopyInto

func (in *EngineSpec) DeepCopyInto(out *EngineSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type EventSink

type EventSink struct {
	// Name identifies the sink: the sink label of the export metrics and
	// the name in the EventsExported condition. Renaming a sink starts it
	// afresh, without the events the old name hadn't sent.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
	Name string `json:"name"`

	// OTLP sends the events as OpenTelemetry logs, over gRPC or HTTP with
	// protobuf.
	// +optional
	OTLP *OTLPSink `json:"otlp,omitempty"`

	// JSON sends the events as JSON over HTTP(S).
	// +optional
	JSON *JSONSink `json:"json,omitempty"`

	// Compression of the request body. Unset: Gzip. (No API default: a
	// default inside a list item makes GitOps diffs show every sink out
	// of sync.)
	// +optional
	Compression ExportCompression `json:"compression,omitempty"`

	// Insecure allows a plaintext endpoint (http://, grpc://): for a
	// Collector in the cluster. A plaintext sink can't have
	// headersSecretRef.
	// +optional
	Insecure bool `json:"insecure,omitempty"`

	// TLS configures the connection to an https:// or grpcs:// endpoint.
	// The server's certificate is always verified.
	// +optional
	TLS *SinkTLS `json:"tls,omitempty"`

	// HeadersSecretRef names a Secret in the operator's namespace whose
	// keys are header names and whose values are their values
	// (Authorization: Bearer ..., DD-API-KEY: ...). Over gRPC they are sent
	// as metadata, lower-cased. A changed Secret is used from the next
	// request.
	// +optional
	HeadersSecretRef *LocalSecretReference `json:"headersSecretRef,omitempty"`

	// Batch configures how events are grouped into requests.
	// +optional
	Batch ExportBatch `json:"batch,omitempty"`

	// Timeout is one request's deadline, 1s to 60s. Unset: 10s.
	// +kubebuilder:validation:XValidation:rule="duration(self) >= duration('1s') && duration(self) <= duration('60s')",message="timeout must be from 1s to 60s"
	// +optional
	Timeout *metav1.Duration `json:"timeout,omitempty"`

	// Filter limits the events this sink takes.
	// +optional
	Filter ExportFilter `json:"filter,omitempty"`

	// Omit are fields this sink never gets: Snippets (each match keeps its
	// rule and variable), ClientIP, UserAgent, RequestID.
	// +kubebuilder:validation:MaxItems=4
	// +listType=set
	// +optional
	Omit []ExportOmit `json:"omit,omitempty"`
}

EventSink is one export destination: OTLP logs or JSON over HTTP. +kubebuilder:validation:XValidation:rule="has(self.otlp) != has(self.json)",message="a sink needs exactly one of otlp and json" +kubebuilder:validation:XValidation:rule="(has(self.insecure) && self.insecure) || !((has(self.otlp) && self.otlp.endpoint.matches('^(grpc|http)://')) || (has(self.json) && has(self.json.url) && self.json.url.startsWith('http://')))",message="a plaintext endpoint (http://, grpc://) needs insecure: true" +kubebuilder:validation:XValidation:rule="!has(self.headersSecretRef) || !((has(self.otlp) && self.otlp.endpoint.matches('^(grpc|http)://')) || (has(self.json) && has(self.json.url) && self.json.url.startsWith('http://')))",message="a plaintext endpoint (http://, grpc://) can't have headersSecretRef: credentials never travel in clear" +kubebuilder:validation:XValidation:rule="!(has(self.insecure) && self.insecure && has(self.json) && has(self.json.urlSecretRef))",message="a URL from a Secret holds a credential: it must be https://, without insecure: true"

func (*EventSink) DeepCopy

func (in *EventSink) DeepCopy() *EventSink

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventSink.

func (*EventSink) DeepCopyInto

func (in *EventSink) DeepCopyInto(out *EventSink)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type EventsSpec added in v0.5.0

type EventsSpec struct {
	// Redact keeps more of what rules matched out of the events. Omitted,
	// it is {}, so that its defaults show.
	// +optional
	// +kubebuilder:default={}
	Redact RedactSpec `json:"redact,omitempty"`

	// Export sends the security events to SIEMs and log pipelines, from
	// every operator replica, without the control plane (see
	// docs/siem-export.md). Events carry no more than Redact leaves; a sink
	// can only leave out more.
	// +optional
	Export *ExportSpec `json:"export,omitempty"`
}

EventsSpec configures the engines' security events.

func (*EventsSpec) DeepCopy added in v0.5.0

func (in *EventsSpec) DeepCopy() *EventsSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventsSpec.

func (*EventsSpec) DeepCopyInto added in v0.5.0

func (in *EventsSpec) DeepCopyInto(out *EventsSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Exclusion

type Exclusion struct {
	// RuleIDs are the rules to turn off. An ID no rule has is ignored.
	// Required. A set: an ID listed twice draws a warning, and v1 refuses
	// it.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=64
	// +kubebuilder:validation:items:Minimum=1
	// +listType=atomic
	// +optional
	RuleIDs []int32 `json:"ruleIDs,omitempty"`

	// When narrows the exclusion. Unset: the rules are off for every request
	// this policy covers.
	// +optional
	When *ExclusionMatch `json:"when,omitempty"`
}

Exclusion turns rules off, everywhere or only for one path or argument. +kubebuilder:validation:XValidation:rule="has(self.ruleIDs)",message="ruleIDs is required"

func (*Exclusion) DeepCopy

func (in *Exclusion) DeepCopy() *Exclusion

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Exclusion.

func (*Exclusion) DeepCopyInto

func (in *Exclusion) DeepCopyInto(out *Exclusion)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExclusionMatch

type ExclusionMatch struct {
	// Path the exclusion applies to.
	// +optional
	Path PathPattern `json:"path,omitempty"`

	// Argument is a query or body argument the rules, and the rules chained
	// to them, stop looking at. With a rule set whose own SecLang negates
	// ARGS targets (!ARGS:name), the policy gets its own compiled rules, and
	// the exclusion covers the rule only, not its chained rules.
	// +optional
	Argument ArgumentPattern `json:"argument,omitempty"`

	// ArgumentName is a query or body argument whose name (ARGS_NAMES) the
	// rules stop looking at. Requires engines 0.5.0 or later: older ones
	// ignore the exclusion.
	// +optional
	ArgumentName ArgumentPattern `json:"argumentName,omitempty"`

	// Cookie is a request cookie (REQUEST_COOKIES) the rules stop looking
	// at, such as a session token. Requires engines 0.5.0 or later.
	// +optional
	Cookie ArgumentPattern `json:"cookie,omitempty"`

	// Header is a request header (REQUEST_HEADERS) the rules stop looking
	// at, such as Referer, compared case-insensitively. Requires engines
	// 0.5.0 or later.
	// v1 types it as a header name, refusing [ and ] and allowing the other
	// token characters (!#$%&'*+^|~): a header that isn't one draws a
	// warning.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=256
	// +kubebuilder:validation:Pattern=`^[A-Za-z0-9_.\-\[\]]+$`
	// +optional
	Header string `json:"header,omitempty"`
}

ExclusionMatch narrows an exclusion to a path, to what in the request the rules stop looking at (an argument, an argument name, a cookie or a header), or both. +kubebuilder:validation:XValidation:rule="has(self.path) || has(self.argument) || has(self.argumentName) || has(self.cookie) || has(self.header)",message="when needs a path, or what in the request to stop looking at" +kubebuilder:validation:XValidation:rule="[has(self.argument), has(self.argumentName), has(self.cookie), has(self.header)].filter(x, x).size() <= 1",message="at most one of argument, argumentName, cookie and header"

func (*ExclusionMatch) DeepCopy

func (in *ExclusionMatch) DeepCopy() *ExclusionMatch

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExclusionMatch.

func (*ExclusionMatch) DeepCopyInto

func (in *ExclusionMatch) DeepCopyInto(out *ExclusionMatch)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ExclusionMatch) Target added in v0.5.0

func (m *ExclusionMatch) Target() bool

Target reports whether m narrows its exclusion to an argument name, a cookie or a header (m may be nil).

type ExportAction

type ExportAction string

ExportAction is a verdict a sink filters on. +kubebuilder:validation:Enum=Deny;Log

const (
	ExportDeny ExportAction = "Deny"
	ExportLog  ExportAction = "Log"
)

The actions.

type ExportBatch

type ExportBatch struct {
	// MaxEvents is the most events per request, 1 to 1,000. Unset: 500.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=1000
	// +optional
	MaxEvents *int32 `json:"maxEvents,omitempty"`

	// MaxDelay is the longest an event waits for its request to fill,
	// 100ms to 60s. Unset: 5s.
	// +kubebuilder:validation:XValidation:rule="duration(self) >= duration('100ms') && duration(self) <= duration('60s')",message="maxDelay must be from 100ms to 60s"
	// +optional
	MaxDelay *metav1.Duration `json:"maxDelay,omitempty"`

	// MaxInFlight is how many requests are sent before the first is
	// answered, 1 to 4. Unset: 4.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=4
	// +optional
	MaxInFlight *int32 `json:"maxInFlight,omitempty"`
}

ExportBatch configures a sink's requests.

func (*ExportBatch) DeepCopy

func (in *ExportBatch) DeepCopy() *ExportBatch

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportBatch.

func (*ExportBatch) DeepCopyInto

func (in *ExportBatch) DeepCopyInto(out *ExportBatch)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExportCompression

type ExportCompression string

ExportCompression is a request body's compression. +kubebuilder:validation:Enum=Gzip;None

const (
	CompressionGzip ExportCompression = "Gzip"
	CompressionNone ExportCompression = "None"
)

The compressions.

type ExportFilter

type ExportFilter struct {
	// Actions are the verdicts this sink takes: Deny, Log. Unset: both.
	// +kubebuilder:validation:MaxItems=2
	// +listType=set
	// +optional
	Actions []ExportAction `json:"actions,omitempty"`

	// PolicyNamespaces takes only the events of policies in these
	// namespaces, as the bundle the replica serves knows them: an event
	// whose policy isn't in the bundle, or that has none, goes only to
	// sinks without this filter. Unset: all.
	// +kubebuilder:validation:MaxItems=64
	// +listType=set
	// +optional
	PolicyNamespaces []NamespaceName `json:"policyNamespaces,omitempty"`
}

ExportFilter limits a sink's events.

func (*ExportFilter) DeepCopy

func (in *ExportFilter) DeepCopy() *ExportFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportFilter.

func (*ExportFilter) DeepCopyInto

func (in *ExportFilter) DeepCopyInto(out *ExportFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExportOmit

type ExportOmit string

ExportOmit is a field a sink leaves out. +kubebuilder:validation:Enum=Snippets;ClientIP;UserAgent;RequestID

const (
	OmitSnippets  ExportOmit = "Snippets"
	OmitClientIP  ExportOmit = "ClientIP"
	OmitUserAgent ExportOmit = "UserAgent"
	OmitRequestID ExportOmit = "RequestID"
)

The fields a sink can omit.

type ExportSpec

type ExportSpec struct {
	// ClusterName names the cluster in every exported event, beside its ID
	// (the kube-system Namespace's UID).
	// +kubebuilder:validation:MaxLength=253
	// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
	// +optional
	ClusterName string `json:"clusterName,omitempty"`

	// Sinks are where the events go, at most 4. None: no export.
	// +kubebuilder:validation:MaxItems=4
	// +kubebuilder:validation:XValidation:rule="self.all(a, self.exists_one(b, b.name == a.name))",message="sinks must not repeat a name"
	// +listType=atomic
	// +optional
	Sinks []EventSink `json:"sinks,omitempty"`
}

ExportSpec configures the export of security events.

func (*ExportSpec) DeepCopy

func (in *ExportSpec) DeepCopy() *ExportSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportSpec.

func (*ExportSpec) DeepCopyInto

func (in *ExportSpec) DeepCopyInto(out *ExportSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type FailureMode

type FailureMode string

FailureMode is what happens to a request that can't be inspected in time (timeout, error, overload). +kubebuilder:validation:Enum=Open;Closed

const (
	// FailOpen lets the request through uninspected.
	FailOpen FailureMode = "Open"
	// FailClosed rejects the request with 503.
	FailClosed FailureMode = "Closed"
)

type GRPCAction added in v0.5.0

type GRPCAction string

GRPCAction is whether a policy lets gRPC calls through. +kubebuilder:validation:Enum=Allow;Deny

const (
	// GRPCAllow inspects gRPC calls as gRPC (the default).
	GRPCAllow GRPCAction = "Allow"
	// GRPCDeny denies them: for routes that serve no gRPC.
	GRPCDeny GRPCAction = "Deny"
)

type GRPCMessagesAction added in v0.4.0

type GRPCMessagesAction string

GRPCMessagesAction is whether gRPC messages are inspected. +kubebuilder:validation:Enum=Inspect;Skip

const (
	// GRPCMessagesInspect inspects the text in gRPC calls' messages.
	GRPCMessagesInspect GRPCMessagesAction = "Inspect"
	// GRPCMessagesSkip inspects a gRPC call's path and metadata only.
	GRPCMessagesSkip GRPCMessagesAction = "Skip"
)

type GRPCSchema

type GRPCSchema struct {
	// ConfigMapRef names a key of a ConfigMap in the policy's namespace,
	// labeled waf.inkwall.dev/rules=true, whose binaryData holds a
	// FileDescriptorSet with its imports (buf build, or protoc
	// --include_imports --descriptor_set_out), raw or gzipped.
	ConfigMapRef ConfigMapKeyRef `json:"configMapRef"`
}

GRPCSchema is where a policy's gRPC schema comes from.

func (*GRPCSchema) DeepCopy

func (in *GRPCSchema) DeepCopy() *GRPCSchema

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GRPCSchema.

func (*GRPCSchema) DeepCopyInto

func (in *GRPCSchema) DeepCopyInto(out *GRPCSchema)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GRPCStreamsMode added in v0.6.0

type GRPCStreamsMode string

GRPCStreamsMode is how a gRPC call's messages are read: the buffered body, or one by one as they come. +kubebuilder:validation:Enum=Buffer;PerMessage

const (
	// GRPCStreamsBuffer inspects the messages in the body the proxy
	// buffers, up to maxBytes in all (the default).
	GRPCStreamsBuffer GRPCStreamsMode = "Buffer"
	// GRPCStreamsPerMessage inspects each message as it comes, up to
	// maxBytes each, through Envoy (#315).
	GRPCStreamsPerMessage GRPCStreamsMode = "PerMessage"
)

type GeoConfig

type GeoConfig struct {
	// Database is the MaxMind DB (MMDB) of countries: GeoLite2 or GeoIP2
	// Country or City, DB-IP's Country Lite, or a compatible one. Inkwall
	// ships none: you provide it, under its vendor's terms.
	Database GeoDatabase `json:"database"`
}

GeoConfig configures geo blocking.

func (*GeoConfig) DeepCopy

func (in *GeoConfig) DeepCopy() *GeoConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeoConfig.

func (*GeoConfig) DeepCopyInto

func (in *GeoConfig) DeepCopyInto(out *GeoConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GeoDatabase

type GeoDatabase struct {
	// File is a path under /var/lib/inkwall/geo/, where the Helm chart
	// mounts geo.volume or the geoipupdate sidecar writes. The operator
	// polls it every minute; replace it atomically (by a rename).
	// +kubebuilder:validation:MaxLength=512
	// +kubebuilder:validation:Pattern=`^/var/lib/inkwall/geo(/[A-Za-z0-9_-][A-Za-z0-9._-]*)+$`
	// +optional
	File string `json:"file,omitempty"`

	// SecretRef is a key of a Secret in the operator's namespace, raw or
	// gzipped: at most 1 MiB, so for small custom databases and tests.
	// +optional
	SecretRef *SecretKeyReference `json:"secretRef,omitempty"`
}

GeoDatabase is where the operator reads the database: a file in its pod or a Secret in its namespace. +kubebuilder:validation:XValidation:rule="has(self.file) != has(self.secretRef)",message="the database needs exactly one of file and secretRef"

func (*GeoDatabase) DeepCopy

func (in *GeoDatabase) DeepCopy() *GeoDatabase

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeoDatabase.

func (*GeoDatabase) DeepCopyInto

func (in *GeoDatabase) DeepCopyInto(out *GeoDatabase)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GeoMode

type GeoMode string

GeoMode makes geo only log, on a Block policy too. +kubebuilder:validation:Enum=Detect

const GeoModeDetect GeoMode = "Detect"

GeoModeDetect logs what geo would deny.

type GeoSpec

type GeoSpec struct {
	// Deny lists the countries whose clients are denied (403, reason
	// geo-deny).
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=250
	// +listType=set
	// +optional
	Deny []CountryCode `json:"deny,omitempty"`

	// Allow lists the only countries whose clients get through geo. Unlike
	// an IP allow list, it doesn't skip inspection: their requests still go
	// through the rate limits and the rules.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=250
	// +listType=set
	// +optional
	Allow []CountryCode `json:"allow,omitempty"`

	// Unknown is what to do with a public address the database has no
	// country for: Allow (the default) or Deny.
	// +kubebuilder:default=Allow
	// +optional
	Unknown GeoUnknown `json:"unknown,omitempty"`

	// Mode Detect logs what geo would deny instead of denying it, on a
	// Block policy too. Unset: the policy's mode.
	// +optional
	Mode GeoMode `json:"mode,omitempty"`
}

GeoSpec is a policy's geo blocking: a deny list or an allow list of countries. Private addresses (and requests with no client IP) are never denied by geo, unless the database maps them. +kubebuilder:validation:XValidation:rule="has(self.deny) != has(self.allow)",message="geo needs exactly one of deny and allow"

func (*GeoSpec) DeepCopy

func (in *GeoSpec) DeepCopy() *GeoSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeoSpec.

func (*GeoSpec) DeepCopyInto

func (in *GeoSpec) DeepCopyInto(out *GeoSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GeoStatus

type GeoStatus struct {
	// SHA256 is the table hash, in hex: what the bundle names and the
	// engines report.
	SHA256 string `json:"sha256"`

	// DatabaseType is the database's type, e.g. GeoLite2-Country.
	DatabaseType string `json:"databaseType"`

	// Built is when the database was built.
	Built metav1.Time `json:"built"`

	// Ranges is the number of address ranges in the table.
	Ranges int64 `json:"ranges"`

	// CompressedBytes is the table's size as sent and stored, gzipped.
	CompressedBytes int64 `json:"compressedBytes"`
}

GeoStatus describes the published country table.

func (*GeoStatus) DeepCopy

func (in *GeoStatus) DeepCopy() *GeoStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeoStatus.

func (*GeoStatus) DeepCopyInto

func (in *GeoStatus) DeepCopyInto(out *GeoStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GeoUnknown

type GeoUnknown string

GeoUnknown is what geo does with a public address the database has no country for. +kubebuilder:validation:Enum=Allow;Deny

const (
	GeoUnknownAllow GeoUnknown = "Allow"
	GeoUnknownDeny  GeoUnknown = "Deny"
)

What geo does with an address without a country.

type HTTPMethodToken added in v0.5.0

type HTTPMethodToken string

HTTPMethodToken is an HTTP request method, such as PUT. +kubebuilder:validation:MinLength=1 +kubebuilder:validation:MaxLength=32 +kubebuilder:validation:Pattern=`^[!#$%&'*+.^_~0-9A-Za-z-]+$`

type HeaderKey

type HeaderKey struct {
	// Name is the header. Not X-Forwarded-For, Forwarded or Host: count
	// by the client IP instead.
	// +kubebuilder:validation:MaxLength=128
	// +kubebuilder:validation:XValidation:rule="!(self.lowerAscii() in ['x-forwarded-for', 'forwarded', 'host'])",message="count by clientIP, not by X-Forwarded-For, Forwarded or Host"
	Name HeaderName `json:"name"`
}

HeaderKey counts by a request header's value.

func (*HeaderKey) DeepCopy

func (in *HeaderKey) DeepCopy() *HeaderKey

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeaderKey.

func (*HeaderKey) DeepCopyInto

func (in *HeaderKey) DeepCopyInto(out *HeaderKey)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HeaderName added in v0.4.0

type HeaderName string

HeaderName is an HTTP header name. +kubebuilder:validation:MinLength=1 +kubebuilder:validation:MaxLength=256 +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+.^_|~-]+$`

type IPListEntry added in v0.5.0

type IPListEntry struct {
	// CIDR is an IPv4 or IPv6 prefix (203.0.113.0/24, 2001:db8::/32) or
	// address.
	CIDR CIDR `json:"cidr"`

	// Description says what the entry is, for people.
	// +kubebuilder:validation:MaxLength=256
	// +optional
	Description string `json:"description,omitempty"`
}

IPListEntry is one address or CIDR prefix of a WAFIPList.

func (*IPListEntry) DeepCopy added in v0.5.0

func (in *IPListEntry) DeepCopy() *IPListEntry

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPListEntry.

func (*IPListEntry) DeepCopyInto added in v0.5.0

func (in *IPListEntry) DeepCopyInto(out *IPListEntry)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type IPListName added in v0.5.0

type IPListName string

IPListName names a WAFIPList. +kubebuilder:validation:MinLength=1 +kubebuilder:validation:MaxLength=253

type IPListsSpec added in v0.5.0

type IPListsSpec struct {
	// Allow lists clients whose requests aren't inspected: health checkers,
	// a scanner you run yourself. Their requests are not logged either.
	// +kubebuilder:validation:MaxItems=16
	// +listType=set
	// +optional
	Allow []IPListName `json:"allow,omitempty"`

	// Deny lists clients whose requests are denied (403) before any rule,
	// or logged in Detect mode.
	// +kubebuilder:validation:MaxItems=16
	// +listType=set
	// +optional
	Deny []IPListName `json:"deny,omitempty"`
}

IPListsSpec names a policy's IP lists.

func (*IPListsSpec) DeepCopy added in v0.5.0

func (in *IPListsSpec) DeepCopy() *IPListsSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPListsSpec.

func (*IPListsSpec) DeepCopyInto added in v0.5.0

func (in *IPListsSpec) DeepCopyInto(out *IPListsSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type InkwallConfig

type InkwallConfig struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec InkwallConfigSpec `json:"spec,omitempty"`
	// +optional
	Status InkwallConfigStatus `json:"status,omitempty"`
}

InkwallConfig is the cluster-wide Inkwall configuration. There is one, named default.

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=inkwall +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default'",message="the InkwallConfig must be named default" +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode` +kubebuilder:printcolumn:name="Suspended",type=boolean,JSONPath=`.spec.suspend` +kubebuilder:printcolumn:name="Bundle",type=integer,JSONPath=`.status.bundle.version` +kubebuilder:printcolumn:name="Engines",type=integer,JSONPath=`.status.engines.connected` +kubebuilder:printcolumn:name="Current",type=integer,JSONPath=`.status.engines.current` +kubebuilder:printcolumn:name="Key",type=string,JSONPath=`.status.signingKey.phase` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*InkwallConfig) DeepCopy

func (in *InkwallConfig) DeepCopy() *InkwallConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfig.

func (*InkwallConfig) DeepCopyInto

func (in *InkwallConfig) DeepCopyInto(out *InkwallConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*InkwallConfig) DeepCopyObject

func (in *InkwallConfig) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type InkwallConfigList

type InkwallConfigList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []InkwallConfig `json:"items"`
}

InkwallConfigList is a list of InkwallConfig.

+kubebuilder:object:root=true

func (*InkwallConfigList) DeepCopy

func (in *InkwallConfigList) DeepCopy() *InkwallConfigList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfigList.

func (*InkwallConfigList) DeepCopyInto

func (in *InkwallConfigList) DeepCopyInto(out *InkwallConfigList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*InkwallConfigList) DeepCopyObject

func (in *InkwallConfigList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type InkwallConfigSpec

type InkwallConfigSpec struct {
	// Mode is where policy comes from: Standalone (the CRDs), GitOps (the
	// CRDs, mirrored to the control plane) or Managed (the control plane).
	// +kubebuilder:default=Standalone
	// +optional
	Mode ClusterMode `json:"mode,omitempty"`

	// ControlPlane is the control plane to connect to. Required in GitOps
	// and Managed mode, ignored in Standalone.
	// +optional
	ControlPlane *ControlPlane `json:"controlPlane,omitempty"`

	// Engine configures the engine sidecars the operator injects. Omitted,
	// it is {}, so that its defaults show.
	// +optional
	// +kubebuilder:default={}
	Engine EngineSpec `json:"engine,omitempty"`

	// Integrations pins how a proxy controller is wired. Controllers are
	// discovered without an entry here; an entry overrides the workload
	// selector for one controller.
	// +listType=map
	// +listMapKey=controller
	// +kubebuilder:validation:MaxItems=32
	// +optional
	Integrations []IntegrationSpec `json:"integrations,omitempty"`

	// Suspend switches every engine to allow-all within seconds, without
	// removing anything: the emergency switch (0004 §5).
	// +optional
	Suspend bool `json:"suspend,omitempty"`

	// SigningKey configures the key the operator signs policy bundles with.
	// +optional
	SigningKey SigningKeySpec `json:"signingKey,omitempty"`

	// Events configures what the engines' security events carry to the
	// operator (and on to the control plane, when one is connected).
	// Omitted, it is {}, so that its defaults show.
	// +optional
	// +kubebuilder:default={}
	Events EventsSpec `json:"events,omitempty"`

	// Geo configures geo blocking's country database (docs/geo-blocking.md):
	// the operator compiles it into a country table and sends it to the
	// engines. Policies with spec.geo need it.
	// +optional
	Geo *GeoConfig `json:"geo,omitempty"`

	// Bundle configures how namespaces share the policy bundle. Omitted,
	// it is {}, so that its defaults show.
	// +optional
	// +kubebuilder:default={}
	Bundle BundleSpec `json:"bundle,omitempty"`
}

InkwallConfigSpec is the cluster-wide configuration. +kubebuilder:validation:XValidation:rule="!has(self.mode) || self.mode == 'Standalone' || has(self.controlPlane)",message="controlPlane is required in GitOps and Managed mode"

func (*InkwallConfigSpec) DeepCopy

func (in *InkwallConfigSpec) DeepCopy() *InkwallConfigSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfigSpec.

func (*InkwallConfigSpec) DeepCopyInto

func (in *InkwallConfigSpec) DeepCopyInto(out *InkwallConfigSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type InkwallConfigStatus

type InkwallConfigStatus struct {
	// ObservedGeneration is the generation the status describes.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Conditions describe the configuration's state.
	// +listType=map
	// +listMapKey=type
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Proxies are the proxy controllers the cluster's IngressClasses and
	// GatewayClasses name, and how far Inkwall wires each.
	// +listType=map
	// +listMapKey=controllerName
	// +optional
	Proxies []ProxyStatus `json:"proxies,omitempty"`

	// Bundle is the bundle the engines get.
	// +optional
	Bundle *BundleStatus `json:"bundle,omitempty"`

	// Engines counts the connected engines by the bundle they run.
	// +optional
	Engines *EngineCounts `json:"engines,omitempty"`

	// SigningKey is the bundle signing key and its rotation.
	// +optional
	SigningKey *SigningKeyStatus `json:"signingKey,omitempty"`

	// Geo is the country table published for geo blocking.
	// +optional
	Geo *GeoStatus `json:"geo,omitempty"`
}

InkwallConfigStatus is the cluster view.

func (*InkwallConfigStatus) DeepCopy

func (in *InkwallConfigStatus) DeepCopy() *InkwallConfigStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfigStatus.

func (*InkwallConfigStatus) DeepCopyInto

func (in *InkwallConfigStatus) DeepCopyInto(out *InkwallConfigStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type IntegrationSpec

type IntegrationSpec struct {
	// Controller is the integration name: traefik, envoy-gateway, istio,
	// istio-ingress or haproxy. The operator ignores an entry for any other
	// controller. It should be a DNS label (lower case letters, digits and
	// "-"): any other name draws a warning, and v1 refuses it.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=63
	Controller string `json:"controller"`

	// Selector matches the controller's proxy pods, when they don't carry
	// the controller's default labels. It must select by something (an
	// empty selector would match every pod). The operator restarts to
	// apply a change; pods already running are injected when they restart.
	// +kubebuilder:validation:XValidation:rule="(has(self.matchLabels) && size(self.matchLabels) > 0) || (has(self.matchExpressions) && size(self.matchExpressions) > 0)",message="selector must not be empty: it would select every pod"
	// +optional
	Selector *metav1.LabelSelector `json:"selector,omitempty"`

	// Adapter is ignored: the operator takes each integration's adapter
	// from its built-in table, and four of the values (ExtAuthz, LuaPlugin,
	// AuthURL, Module) have no implementation. It stays so that
	// InkwallConfigs that set it remain valid; setting or changing it draws
	// a warning, and v1 removes it.
	//
	// Deprecated: remove it from the InkwallConfig.
	//
	// +optional
	Adapter AdapterKind `json:"adapter,omitempty"`
}

IntegrationSpec overrides discovery for one proxy controller.

func (*IntegrationSpec) DeepCopy

func (in *IntegrationSpec) DeepCopy() *IntegrationSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntegrationSpec.

func (*IntegrationSpec) DeepCopyInto

func (in *IntegrationSpec) DeepCopyInto(out *IntegrationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JSONFraming

type JSONFraming string

JSONFraming is how JSON events are put in a request body. +kubebuilder:validation:Enum=Lines;Array

const (
	JSONLines JSONFraming = "Lines"
	JSONArray JSONFraming = "Array"
)

The JSON framings.

type JSONSink

type JSONSink struct {
	// URL is the https:// (or http://, with insecure) URL the events are
	// POSTed to, with any path and query. A URL that holds a token belongs
	// in urlSecretRef.
	// +kubebuilder:validation:MaxLength=2048
	// +kubebuilder:validation:Pattern=`^https?://[^/?#@\s]+([/?]\S*)?$`
	// +optional
	URL string `json:"url,omitempty"`

	// URLSecretRef reads the URL from a Secret's key in the operator's
	// namespace instead, for intakes whose URL holds a token (Sumo Logic,
	// query-string keys). It gets url's checks when the sink starts, and
	// must be https://: a URL from a Secret holds a credential.
	// +optional
	URLSecretRef *SecretKeyReference `json:"urlSecretRef,omitempty"`

	// Framing is Lines (one event per line, application/x-ndjson) or
	// Array (one JSON array, application/json). Unset: Lines (no API
	// default, as for compression).
	// +optional
	Framing JSONFraming `json:"framing,omitempty"`
}

JSONSink is an HTTP intake for JSON events. +kubebuilder:validation:XValidation:rule="has(self.url) != has(self.urlSecretRef)",message="json needs exactly one of url and urlSecretRef"

func (*JSONSink) DeepCopy

func (in *JSONSink) DeepCopy() *JSONSink

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSink.

func (*JSONSink) DeepCopyInto

func (in *JSONSink) DeepCopyInto(out *JSONSink)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LLMEndpoint

type LLMEndpoint struct {
	// Paths are exact paths or prefixes ending in "*", compared as rate
	// limits' match.paths: in ASCII lower case, with one trailing slash
	// ignored. A path the engine can't read one way (percent-encoding,
	// ";", "//", dot segments) is checked as an endpoint of each of the
	// policy's formats. skip.paths and skip.bodyPaths win: a body not read
	// isn't checked.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=16
	// +listType=set
	Paths []PathPattern `json:"paths"`

	// Format is the shape of the endpoint's requests.
	Format LLMFormat `json:"format"`
}

LLMEndpoint is paths that serve one LLM API.

func (*LLMEndpoint) DeepCopy

func (in *LLMEndpoint) DeepCopy() *LLMEndpoint

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LLMEndpoint.

func (*LLMEndpoint) DeepCopyInto

func (in *LLMEndpoint) DeepCopyInto(out *LLMEndpoint)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LLMFormat

type LLMFormat string

LLMFormat is the shape of an LLM API's requests. +kubebuilder:validation:Enum=OpenAIChat;OpenAIResponses;OpenAIEmbeddings;AnthropicMessages

const (
	// LLMOpenAIChat is OpenAI's Chat Completions (/v1/chat/completions),
	// as OpenAI-compatible servers (vLLM, Ollama, LiteLLM, llama.cpp)
	// serve it.
	LLMOpenAIChat LLMFormat = "OpenAIChat"
	// LLMOpenAIResponses is OpenAI's Responses (/v1/responses).
	LLMOpenAIResponses LLMFormat = "OpenAIResponses"
	// LLMOpenAIEmbeddings is OpenAI's Embeddings (/v1/embeddings).
	LLMOpenAIEmbeddings LLMFormat = "OpenAIEmbeddings"
	// LLMAnthropicMessages is Anthropic's Messages (/v1/messages).
	LLMAnthropicMessages LLMFormat = "AnthropicMessages"
)

type LLMModelPattern

type LLMModelPattern string

LLMModelPattern is a model ("llama-3.1-8b-instruct") or a prefix ending in "*" ("qwen2.5-*"), printable ASCII without spaces. +kubebuilder:validation:MinLength=1 +kubebuilder:validation:MaxLength=256 +kubebuilder:validation:Pattern=`^[!-)+-~]+\*?$`

type LLMRequestSpec

type LLMRequestSpec struct {
	// Models are the models allowed: exact, or a prefix ending in "*",
	// compared in ASCII lower case. A request that names no model, or
	// another one, fails llm-model. Unset: any.
	// +kubebuilder:validation:MaxItems=64
	// +listType=set
	// +optional
	Models []LLMModelPattern `json:"models,omitempty"`

	// MaxPromptBytes caps the UTF-8 bytes of the prompt's text, every
	// message together, 1 to 10 MiB (llm-max-prompt). Images, audio and
	// files count toward maxBodyBytes only.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=10485760
	// +optional
	MaxPromptBytes *int64 `json:"maxPromptBytes,omitempty"`

	// MaxMessages caps the messages, input items or embedding inputs of a
	// request, 1 to 100000 (llm-max-messages).
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=100000
	// +optional
	MaxMessages *int32 `json:"maxMessages,omitempty"`

	// MaxChoices caps n, the answers a chat request asks for, 1 to 128
	// (llm-max-choices).
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=128
	// +optional
	MaxChoices *int32 `json:"maxChoices,omitempty"`

	// MaxOutputTokens caps the output limit a request sets (max_tokens,
	// max_completion_tokens, max_output_tokens), 1 to 10000000
	// (llm-max-output-tokens). Inkwall doesn't lower it: a request over
	// the cap is denied.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=10000000
	// +optional
	MaxOutputTokens *int64 `json:"maxOutputTokens,omitempty"`

	// RequireOutputTokens denies a request that sets no output limit
	// (llm-max-output-tokens): without one, OpenAI-compatible servers
	// generate up to the model's maximum. Embeddings have none to set.
	// +optional
	RequireOutputTokens bool `json:"requireOutputTokens,omitempty"`

	// ClientRoles are the roles of the messages a client may send
	// (llm-client-role); the Responses API's instructions and Anthropic's
	// system count as system, and a role none of these as none of them.
	// A chat front end that adds its own system prompt sets user and
	// assistant: a client that sends system or developer overrides it.
	// Unset: every role.
	// +kubebuilder:validation:MaxItems=5
	// +listType=set
	// +optional
	ClientRoles []LLMRole `json:"clientRoles,omitempty"`

	// Tools are the tools a client may define (llm-tools). Unset: any.
	// +optional
	Tools *LLMToolsSpec `json:"tools,omitempty"`

	// Mode Detect logs the requests that fail a check instead of denying
	// them, on a Block policy. Unset: the policy's mode. Block isn't
	// allowed: the checks can't be stricter than their policy.
	// +kubebuilder:validation:XValidation:rule="self == 'Detect'",message="the LLM checks' mode can only be Detect: they can't be stricter than their policy"
	// +optional
	Mode PolicyMode `json:"mode,omitempty"`
}

LLMRequestSpec are the checks an endpoint's requests must meet. Each failed check denies, in Block mode, with 400 (413 for maxPromptBytes and maxMessages), in this order: the first decides.

func (*LLMRequestSpec) DeepCopy

func (in *LLMRequestSpec) DeepCopy() *LLMRequestSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LLMRequestSpec.

func (*LLMRequestSpec) DeepCopyInto

func (in *LLMRequestSpec) DeepCopyInto(out *LLMRequestSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LLMRole

type LLMRole string

LLMRole is who wrote a message. +kubebuilder:validation:Enum=system;developer;user;assistant;tool

type LLMRuleSetBody

type LLMRuleSetBody string

LLMRuleSetBody is whether the rule sets inspect the bodies of LLM endpoints. +kubebuilder:validation:Enum=Skip;Inspect

const (
	// LLMRuleSetBodySkip has the rule sets inspect an endpoint's method, URI,
	// headers and cookies, not its bodies.
	LLMRuleSetBodySkip LLMRuleSetBody = "Skip"
	// LLMRuleSetBodyInspect has them inspect its bodies too, as on any route.
	LLMRuleSetBodyInspect LLMRuleSetBody = "Inspect"
)

type LLMSpec

type LLMSpec struct {
	// Endpoints are the policy's paths that serve an LLM API, each with
	// its format. Declared, not guessed: gateways and Azure OpenAI serve
	// these APIs on other paths. A path of no endpoint is an ordinary
	// route to the policy.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=8
	// +kubebuilder:validation:XValidation:rule="self.all(e, e.paths.all(p, self.filter(f, p in f.paths).size() == 1))",message="an endpoint path can't be in two endpoints"
	// +listType=atomic
	Endpoints []LLMEndpoint `json:"endpoints"`

	// MaxBodyBytes is the request body read on an endpoint, 1 KiB to 10
	// MiB, instead of body.maxBytes: chat histories and agents' contexts
	// are large. A longer body gets body.onOversize (413 in Block mode by
	// default). The proxy's own buffer still bounds what reaches the
	// engine (docs/llm-apis.md). Unset: 1 MiB.
	// +kubebuilder:validation:Minimum=1024
	// +kubebuilder:validation:Maximum=10485760
	// +optional
	MaxBodyBytes *int64 `json:"maxBodyBytes,omitempty"`

	// RuleSetBody is whether the rule sets (the CRS, SecLang) inspect the
	// endpoints' request and response bodies too. Skip, the default: they
	// inspect the endpoints' method, URI, headers and cookies, and the LLM
	// checks the bodies; prose and pasted code trip the CRS's SQL
	// injection and XSS rules all the time, and its cost on large bodies
	// is out of every latency budget. This changes what the rule sets read
	// on a route that adds spec.llm. Inspect: they inspect the bodies, up
	// to maxBodyBytes, as on any route (unless body.inspect is false).
	// +optional
	RuleSetBody LLMRuleSetBody `json:"ruleSetBody,omitempty"`

	// Request sets the request checks. Unset: only that bodies are
	// well-formed (llm-malformed).
	// +optional
	Request *LLMRequestSpec `json:"request,omitempty"`
}

LLMSpec declares a policy's LLM API endpoints and their checks.

func (*LLMSpec) DeepCopy

func (in *LLMSpec) DeepCopy() *LLMSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LLMSpec.

func (*LLMSpec) DeepCopyInto

func (in *LLMSpec) DeepCopyInto(out *LLMSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LLMToolName

type LLMToolName string

LLMToolName is a tool's name. +kubebuilder:validation:MinLength=1 +kubebuilder:validation:MaxLength=256 +kubebuilder:validation:Pattern=`^[A-Za-z0-9_.:/-]+$`

type LLMToolsAllow

type LLMToolsAllow string

LLMToolsAllow is which tools a client may define. +kubebuilder:validation:Enum=Any;None;Listed

const (
	// LLMToolsAny allows any tool.
	LLMToolsAny LLMToolsAllow = "Any"
	// LLMToolsNone allows none.
	LLMToolsNone LLMToolsAllow = "None"
	// LLMToolsListed allows the tools names lists.
	LLMToolsListed LLMToolsAllow = "Listed"
)

type LLMToolsSpec

type LLMToolsSpec struct {
	// Allow is Any (the default), None, or Listed: the tools names lists.
	// +optional
	Allow LLMToolsAllow `json:"allow,omitempty"`

	// Names are the tools a client may define with Listed: a function's
	// name, or a built-in tool's type when it has no name
	// ("web_search_preview"), compared exactly.
	// +kubebuilder:validation:MaxItems=128
	// +listType=set
	// +optional
	Names []LLMToolName `json:"names,omitempty"`
}

LLMToolsSpec is which tools a client may define. +kubebuilder:validation:XValidation:rule="(has(self.allow) && self.allow == 'Listed') == (has(self.names) && size(self.names) > 0)",message="names is required with allow: Listed, and only allowed with it"

func (*LLMToolsSpec) DeepCopy

func (in *LLMToolsSpec) DeepCopy() *LLMToolsSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LLMToolsSpec.

func (*LLMToolsSpec) DeepCopyInto

func (in *LLMToolsSpec) DeepCopyInto(out *LLMToolsSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LocalSecretReference

type LocalSecretReference struct {
	// Name of the Secret.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	Name string `json:"name"`
}

LocalSecretReference names a Secret in the operator's namespace.

func (*LocalSecretReference) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalSecretReference.

func (*LocalSecretReference) DeepCopyInto

func (in *LocalSecretReference) DeepCopyInto(out *LocalSecretReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LogLevel added in v0.5.0

type LogLevel string

LogLevel is an engine's log level. +kubebuilder:validation:Enum=Debug;Info;Warn;Error

const (
	LogLevelDebug LogLevel = "Debug"
	LogLevelInfo  LogLevel = "Info"
	LogLevelWarn  LogLevel = "Warn"
	LogLevelError LogLevel = "Error"
)

Engine log levels.

type MediaType added in v0.5.0

type MediaType string

MediaType is a media type without parameters, such as application/json. +kubebuilder:validation:MinLength=3 +kubebuilder:validation:MaxLength=129 +kubebuilder:validation:Pattern=`^[!#$%&'*+.^_~0-9A-Za-z-]+/[!#$%&'*+.^_~0-9A-Za-z-]+$`

type NamespaceName

type NamespaceName string

NamespaceName is a Kubernetes namespace's name: a DNS label. +kubebuilder:validation:MinLength=1 +kubebuilder:validation:MaxLength=63 +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`

type NamespacedConfigMapKeyRef

type NamespacedConfigMapKeyRef struct {
	ConfigMapKeyRef `json:",inline"`

	// Namespace of the ConfigMap.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=63
	Namespace string `json:"namespace"`
}

NamespacedConfigMapKeyRef names a key of a ConfigMap in any namespace.

func (*NamespacedConfigMapKeyRef) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedConfigMapKeyRef.

func (*NamespacedConfigMapKeyRef) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OTLPSink

type OTLPSink struct {
	// Endpoint is grpcs://host:port (or grpc://, with insecure) for gRPC,
	// or an https:// (or http://) URL for HTTP with protobuf, used as is:
	// OTLP/HTTP's path, usually /v1/logs, is part of it.
	// +kubebuilder:validation:MaxLength=512
	// +kubebuilder:validation:Pattern=`^(grpcs?://[^/?#@\s]+|https?://[^/?#@\s]+([/?]\S*)?)$`
	Endpoint string `json:"endpoint"`
}

OTLPSink is an OpenTelemetry (OTLP) logs receiver.

func (*OTLPSink) DeepCopy

func (in *OTLPSink) DeepCopy() *OTLPSink

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OTLPSink.

func (*OTLPSink) DeepCopyInto

func (in *OTLPSink) DeepCopyInto(out *OTLPSink)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OversizeAction

type OversizeAction string

OversizeAction is what happens to a body larger than body.maxBytes. +kubebuilder:validation:Enum=Allow;Deny

const (
	// OversizeAllow forwards the request with the body uninspected, and logs
	// it.
	OversizeAllow OversizeAction = "Allow"
	// OversizeDeny rejects the request with 413 in Block mode.
	OversizeDeny OversizeAction = "Deny"
)

type PathPattern

type PathPattern string

PathPattern is an exact path ("/healthz") or a prefix ending in "*" ("/static/*"), using only plain ASCII path characters, as the engine matches paths (pkg/router). +kubebuilder:validation:MaxLength=1024 +kubebuilder:validation:Pattern=`^/[A-Za-z0-9._~/:@!$&'()+,=-]*\*?$`

type PolicyMode

type PolicyMode string

PolicyMode is what the engine does with a request the rules flag. +kubebuilder:validation:Enum=Detect;Block

const (
	// PolicyDetect logs the verdict and lets the request through.
	PolicyDetect PolicyMode = "Detect"
	// PolicyBlock rejects the request.
	PolicyBlock PolicyMode = "Block"
)

type ProxyStatus added in v0.3.0

type ProxyStatus struct {
	// ControllerName is the controller its classes name: an IngressClass's
	// spec.controller, a GatewayClass's spec.controllerName.
	// +kubebuilder:validation:MaxLength=253
	ControllerName string `json:"controllerName"`

	// Integration is Inkwall's integration for the controller, such as
	// traefik; empty when Inkwall has none.
	// +kubebuilder:validation:MaxLength=63
	// +optional
	Integration string `json:"integration,omitempty"`

	// IngressClasses are the IngressClasses of the controller, sorted, up
	// to 64.
	// +kubebuilder:validation:MaxItems=64
	// +kubebuilder:validation:items:MaxLength=253
	// +listType=set
	// +optional
	IngressClasses []string `json:"ingressClasses,omitempty"`

	// GatewayClasses are the GatewayClasses of the controller, sorted, up
	// to 64.
	// +kubebuilder:validation:MaxItems=64
	// +kubebuilder:validation:items:MaxLength=253
	// +listType=set
	// +optional
	GatewayClasses []string `json:"gatewayClasses,omitempty"`

	// Support is Full, Partial or Unsupported.
	Support Support `json:"support"`

	// Message says what isn't wired.
	// +kubebuilder:validation:MaxLength=1024
	// +optional
	Message string `json:"message,omitempty"`
}

ProxyStatus is a proxy controller found in the cluster.

func (*ProxyStatus) DeepCopy added in v0.3.0

func (in *ProxyStatus) DeepCopy() *ProxyStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyStatus.

func (*ProxyStatus) DeepCopyInto added in v0.3.0

func (in *ProxyStatus) DeepCopyInto(out *ProxyStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RateLimit

type RateLimit struct {
	// Name names the limit in events and logs; unique in the policy.
	// Renaming a limit starts its buckets again full.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
	Name string `json:"name"`

	// Requests are the requests allowed per period, per key, per engine,
	// at most 1000000; with cost: LLMTokens, the tokens, at most
	// 1000000000.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=1000000000
	Requests int64 `json:"requests"`

	// Period is the period of requests, 1s to 1h.
	// +kubebuilder:validation:XValidation:rule="duration(self) >= duration('1s') && duration(self) <= duration('1h')",message="period must be 1s to 1h"
	Period metav1.Duration `json:"period"`

	// Burst is the requests (or tokens) a key may send at once after being
	// idle. Unset: requests.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=1000000000
	// +optional
	Burst *int64 `json:"burst,omitempty"`

	// Cost is what the limit counts: Requests (the default), or LLMTokens
	// (docs/llm-apis.md#token-limits): requests and burst are then tokens,
	// and a request on one of the policy's LLM endpoints (spec.llm), once
	// it passed its checks, takes its estimate at once (prompt bytes / 3
	// plus its output limit), corrected by the tokens its response reports
	// using when the policy inspects responses; other requests aren't
	// counted. A key in debt is refused before its body is read. Engines
	// before 0.7.0 count each request as 1.
	// +optional
	Cost RateLimitCost `json:"cost,omitempty"`

	// Key is what the limit counts by. Unset: the client IP.
	// +optional
	Key *RateLimitKey `json:"key,omitempty"`

	// Match narrows the limit to some of the policy's requests. Unset:
	// every request of the policy.
	// +optional
	Match *RateLimitMatch `json:"match,omitempty"`

	// Mode Detect logs the requests over the limit instead of denying
	// them, on a Block policy. Unset: the policy's mode. Block isn't
	// allowed: a limit can't be stricter than its policy.
	// +kubebuilder:validation:XValidation:rule="self == 'Detect'",message="a rate limit's mode can only be Detect: a limit can't be stricter than its policy"
	// +optional
	Mode PolicyMode `json:"mode,omitempty"`
}

RateLimit is a token bucket per key: it holds at most burst requests and gains requests per period, evenly. +kubebuilder:validation:XValidation:rule="(has(self.cost) && self.cost == 'LLMTokens') || (self.requests <= 1000000 && (!has(self.burst) || self.burst <= 1000000))",message="requests and burst are at most 1000000, or 1000000000 tokens with cost: LLMTokens"

func (*RateLimit) DeepCopy

func (in *RateLimit) DeepCopy() *RateLimit

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimit.

func (*RateLimit) DeepCopyInto

func (in *RateLimit) DeepCopyInto(out *RateLimit)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RateLimitCost

type RateLimitCost string

RateLimitCost is what a rate limit counts. +kubebuilder:validation:Enum=Requests;LLMTokens

const (
	// RateLimitRequests counts requests.
	RateLimitRequests RateLimitCost = "Requests"
	// RateLimitLLMTokens counts LLM tokens.
	RateLimitLLMTokens RateLimitCost = "LLMTokens"
)

type RateLimitKey

type RateLimitKey struct {
	// ClientIP counts by the client address the engine resolves
	// (docs/client-ip.md).
	// +optional
	ClientIP *ClientIPKey `json:"clientIP,omitempty"`

	// Header counts by a request header's value, for fairness between
	// authenticated clients (an API key, a tenant). A client chooses its
	// header's value, so this doesn't stop an attacker: a request without
	// the header is counted by its client IP.
	// +optional
	Header *HeaderKey `json:"header,omitempty"`
}

RateLimitKey is what a limit counts by: exactly one of clientIP and header. +kubebuilder:validation:XValidation:rule="has(self.clientIP) != has(self.header)",message="key needs exactly one of clientIP and header"

func (*RateLimitKey) DeepCopy

func (in *RateLimitKey) DeepCopy() *RateLimitKey

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimitKey.

func (*RateLimitKey) DeepCopyInto

func (in *RateLimitKey) DeepCopyInto(out *RateLimitKey)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RateLimitMatch

type RateLimitMatch struct {
	// Paths the limit counts: exact paths or prefixes ending in "*",
	// compared in ASCII lower case with one trailing slash ignored. A path
	// the engine can't read one way (percent-encoding, ";", "//", dot
	// segments) counts against every limit with paths.
	// +kubebuilder:validation:MaxItems=16
	// +listType=set
	// +optional
	Paths []PathPattern `json:"paths,omitempty"`

	// Methods the limit counts.
	// +kubebuilder:validation:MaxItems=9
	// +listType=set
	// +optional
	Methods []RateLimitMethod `json:"methods,omitempty"`
}

RateLimitMatch narrows a limit to some of the policy's requests.

func (*RateLimitMatch) DeepCopy

func (in *RateLimitMatch) DeepCopy() *RateLimitMatch

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimitMatch.

func (*RateLimitMatch) DeepCopyInto

func (in *RateLimitMatch) DeepCopyInto(out *RateLimitMatch)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RateLimitMethod

type RateLimitMethod string

RateLimitMethod is a standard HTTP request method. +kubebuilder:validation:Enum=GET;HEAD;POST;PUT;PATCH;DELETE;OPTIONS;CONNECT;TRACE

type RedactSpec added in v0.5.0

type RedactSpec struct {
	// Headers are more header names whose values leave no snippet, matched
	// without regard to case.
	// +kubebuilder:validation:MaxItems=64
	// +listType=set
	// +optional
	Headers []HeaderName `json:"headers,omitempty"`

	// Arguments are more argument-name patterns: a match on a query or
	// body argument whose name contains one, without regard to case, leaves
	// no snippet ("email" covers email, user_email and json.user.Email).
	// +kubebuilder:validation:MaxItems=64
	// +listType=set
	// +optional
	Arguments []ArgumentPattern `json:"arguments,omitempty"`

	// Snippets set to false sends no snippets at all: events keep the rule
	// and the variable it matched, never what it matched.
	// +kubebuilder:default=true
	// +optional
	Snippets *bool `json:"snippets,omitempty"`
}

RedactSpec adds to the redaction every engine applies to the snippets of its security events: the up to 64 bytes of what each rule matched. Always redacted: cookies, response bodies, the Authorization, Cookie, Set-Cookie and Proxy-Authorization headers, and arguments and headers whose names look like credentials (password, secret, token, api key, auth, session, JWT, card, SSN; see docs/design/0002 §8.3).

func (*RedactSpec) DeepCopy added in v0.5.0

func (in *RedactSpec) DeepCopy() *RedactSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedactSpec.

func (*RedactSpec) DeepCopyInto added in v0.5.0

func (in *RedactSpec) DeepCopyInto(out *RedactSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResponsesSpec added in v0.4.0

type ResponsesSpec struct {
	// Inspect turns response inspection on: the status and headers, and
	// the body when its media type is text (plain, HTML, XML, CSV),
	// JavaScript, JSON or XML (a +json or +xml type too), malformed, or
	// missing. A request's Range is removed, so the body comes whole.
	// In Block mode a response the rules flag is replaced with the
	// rule's status (403) and a plain-text error.
	// +optional
	Inspect bool `json:"inspect,omitempty"`

	// MaxBytes is how much of a response body is inspected, at most 10
	// MiB. Unset: 64 KiB, the engine's default, which doesn't change
	// within v1 (each KiB costs about 0.3 ms of inspection: raise timeout
	// with it). A longer body has this much inspected, and then gets
	// onOversize.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=10485760
	// +optional
	MaxBytes *int64 `json:"maxBytes,omitempty"`

	// OnOversize is what happens to a response whose body is over maxBytes
	// or can't be inspected (an encoding other than gzip or deflate): Deny
	// (replaced with 502 in Block mode) or Allow (forwarded, and logged).
	// Unset: Deny in Block mode, Allow in Detect mode.
	// +optional
	OnOversize OversizeAction `json:"onOversize,omitempty"`

	// Streams is what happens to the body of a streamed response: Server-
	// Sent Events (text/event-stream) and gRPC responses. Inspect: each
	// event, or message, is inspected on its own, up to maxBytes; in Block
	// mode one that leaks ends the stream (the client gets the events
	// before it), and one over maxBytes gets onOversize. Each event is an
	// evaluation, so a token-by-token stream costs many. Skip: only their
	// status and headers are inspected. Through Envoy Gateway and Istio;
	// HAProxy doesn't send their bodies (the policy is then not Programmed
	// on its Ingresses, ResponsesNotInspected), and engines before 0.6.0
	// skip them (the policy is then not Enforced).
	// +kubebuilder:default=Skip
	// +optional
	Streams StreamsAction `json:"streams,omitempty"`
}

ResponsesSpec configures response inspection. +kubebuilder:validation:XValidation:rule="(has(self.inspect) && self.inspect) || (!has(self.maxBytes) && !has(self.onOversize) && (!has(self.streams) || self.streams == 'Skip'))",message="maxBytes, onOversize and streams: Inspect need inspect: true"

func (*ResponsesSpec) DeepCopy added in v0.4.0

func (in *ResponsesSpec) DeepCopy() *ResponsesSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResponsesSpec.

func (*ResponsesSpec) DeepCopyInto added in v0.4.0

func (in *ResponsesSpec) DeepCopyInto(out *ResponsesSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RolloutPolicy added in v0.5.0

type RolloutPolicy string

RolloutPolicy is how proxy pods get a new engine. +kubebuilder:validation:Enum=Manual;Automatic

const (
	RolloutManual    RolloutPolicy = "Manual"
	RolloutAutomatic RolloutPolicy = "Automatic"
)

The rollout policies.

type RuleSetBinding

type RuleSetBinding struct {
	// Ref is the rule set.
	Ref RuleSetRef `json:"ref"`

	// ParanoiaLevel is crs.paranoiaLevel, which takes its place, and can't
	// be set with it. It stays so that policies that set it remain valid;
	// setting it draws a warning, and v1 moves it to crs.
	//
	// Deprecated: use crs.paranoiaLevel.
	//
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=4
	// +optional
	ParanoiaLevel *int32 `json:"paranoiaLevel,omitempty"`

	// InboundAnomalyThreshold is crs.inboundAnomalyThreshold, which takes
	// its place, and can't be set with it. It stays so that policies that
	// set it remain valid; setting it draws a warning, and v1 moves it to
	// crs.
	//
	// Deprecated: use crs.inboundAnomalyThreshold.
	//
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=10000
	// +optional
	InboundAnomalyThreshold *int32 `json:"inboundAnomalyThreshold,omitempty"`

	// CRS sets the OWASP CRS's own settings. Only used by the built-in CRS:
	// on another rule set they are ignored, which the Accepted condition
	// says. Every engine applies paranoiaLevel and
	// inboundAnomalyThreshold; the other settings require engines 0.5.0 or
	// later, and older ones ignore them.
	// +optional
	CRS *CRSSettings `json:"crs,omitempty"`

	// Placement is where a SecLang rule set loads: AfterCRS (unset) or
	// BeforeCRS, before the CRS's initialization, so its rules can set
	// the CRS's tx variables or turn CRS rules off with
	// ctl:ruleRemoveById. A BeforeCRS rule set can't use SecRuleRemoveBy*
	// or SecRuleUpdate*, which only reach rules loaded before them. Not
	// for the built-in CRS. Requires engines 0.6.0 or later: older ones
	// load the rule set after the CRS. No API default: a default inside a
	// list item makes GitOps diffs (Argo CD's) show every policy with rule
	// sets out of sync.
	// +optional
	Placement RuleSetPlacement `json:"placement,omitempty"`
}

RuleSetBinding uses a rule set in a policy. +kubebuilder:validation:XValidation:rule="!has(self.paranoiaLevel) || !has(self.crs) || !has(self.crs.paranoiaLevel)",message="set crs.paranoiaLevel, not also the deprecated paranoiaLevel" +kubebuilder:validation:XValidation:rule="!has(self.inboundAnomalyThreshold) || !has(self.crs) || !has(self.crs.inboundAnomalyThreshold)",message="set crs.inboundAnomalyThreshold, not also the deprecated inboundAnomalyThreshold"

func (*RuleSetBinding) CRSInboundAnomalyThreshold

func (b *RuleSetBinding) CRSInboundAnomalyThreshold() *int32

CRSInboundAnomalyThreshold is b's inbound anomaly threshold: crs.inboundAnomalyThreshold, else the deprecated inboundAnomalyThreshold; nil when neither is set.

func (*RuleSetBinding) CRSParanoiaLevel

func (b *RuleSetBinding) CRSParanoiaLevel() *int32

CRSParanoiaLevel is b's paranoia level: crs.paranoiaLevel, else the deprecated paranoiaLevel; nil when neither is set.

func (*RuleSetBinding) DeepCopy

func (in *RuleSetBinding) DeepCopy() *RuleSetBinding

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetBinding.

func (*RuleSetBinding) DeepCopyInto

func (in *RuleSetBinding) DeepCopyInto(out *RuleSetBinding)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RuleSetBinding) SetsCRS

func (b *RuleSetBinding) SetsCRS() bool

SetsCRS reports whether b sets any CRS setting, deprecated or not.

type RuleSetPlacement added in v0.6.0

type RuleSetPlacement string

RuleSetPlacement is where a rule set loads, relative to the built-in CRS. +kubebuilder:validation:Enum=BeforeCRS;AfterCRS

const (
	// PlacementAfterCRS loads the rule set after the CRS (the default).
	PlacementAfterCRS RuleSetPlacement = "AfterCRS"
	// PlacementBeforeCRS loads the rule set before the CRS.
	PlacementBeforeCRS RuleSetPlacement = "BeforeCRS"
)

type RuleSetRef

type RuleSetRef struct {
	// Kind is WAFRuleSet or ClusterWAFRuleSet.
	// +kubebuilder:validation:Enum=WAFRuleSet;ClusterWAFRuleSet
	Kind string `json:"kind"`

	// Name of the rule set.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	Name string `json:"name"`

	// Namespace of a WAFRuleSet, which can only be the policy's: unset means
	// that, and another namespace is never resolved (the policy isn't
	// Accepted; bind a ClusterWAFRuleSet instead). Setting it draws a
	// warning, and v1 removes it.
	//
	// Deprecated: leave it unset.
	//
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=63
	// +optional
	Namespace string `json:"namespace,omitempty"`
}

RuleSetRef names a WAFRuleSet or a ClusterWAFRuleSet. +kubebuilder:validation:XValidation:rule="self.kind == 'WAFRuleSet' || !has(self.__namespace__)",message="namespace is only allowed for a WAFRuleSet"

func (*RuleSetRef) DeepCopy

func (in *RuleSetRef) DeepCopy() *RuleSetRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetRef.

func (*RuleSetRef) DeepCopyInto

func (in *RuleSetRef) DeepCopyInto(out *RuleSetRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RuleSetSource

type RuleSetSource struct {
	// Builtin is a rule set shipped in the engine image.
	// +optional
	Builtin BuiltinRuleSet `json:"builtin,omitempty"`

	// SecLang holds the rules inline, at most 256 KiB.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=262144
	// +optional
	SecLang string `json:"seclang,omitempty"`

	// ConfigMapRef reads the rules from a ConfigMap in the rule set's
	// namespace.
	// +optional
	ConfigMapRef *ConfigMapKeyRef `json:"configMapRef,omitempty"`
}

RuleSetSource is where a WAFRuleSet's rules come from: exactly one of builtin, seclang or configMapRef. +kubebuilder:validation:XValidation:rule="[has(self.builtin), has(self.seclang), has(self.configMapRef)].filter(x, x).size() == 1",message="set exactly one of builtin, seclang or configMapRef"

func (*RuleSetSource) DeepCopy

func (in *RuleSetSource) DeepCopy() *RuleSetSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetSource.

func (*RuleSetSource) DeepCopyInto

func (in *RuleSetSource) DeepCopyInto(out *RuleSetSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RuleSetStatus

type RuleSetStatus struct {
	// ObservedGeneration is the generation the status describes.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Conditions describe the rule set's state.
	// +listType=map
	// +listMapKey=type
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

RuleSetStatus reports whether a rule set is usable.

func (*RuleSetStatus) DeepCopy

func (in *RuleSetStatus) DeepCopy() *RuleSetStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetStatus.

func (*RuleSetStatus) DeepCopyInto

func (in *RuleSetStatus) DeepCopyInto(out *RuleSetStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SecretKeyReference

type SecretKeyReference struct {
	// Name of the Secret.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	Name string `json:"name"`

	// Key in the Secret.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	// +kubebuilder:validation:Pattern=`^[-._a-zA-Z0-9]+$`
	Key string `json:"key"`
}

SecretKeyReference names a key of a Secret in the operator's namespace.

func (*SecretKeyReference) DeepCopy

func (in *SecretKeyReference) DeepCopy() *SecretKeyReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeyReference.

func (*SecretKeyReference) DeepCopyInto

func (in *SecretKeyReference) DeepCopyInto(out *SecretKeyReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SecretReference

type SecretReference struct {
	// Name of the Secret.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	Name string `json:"name"`

	// Namespace of the Secret, which can only be the operator's namespace.
	// Unset: the operator's namespace.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=63
	// +optional
	Namespace string `json:"namespace,omitempty"`
}

SecretReference names a Secret in the operator's namespace.

func (*SecretReference) DeepCopy

func (in *SecretReference) DeepCopy() *SecretReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference.

func (*SecretReference) DeepCopyInto

func (in *SecretReference) DeepCopyInto(out *SecretReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SigningKeyPhase added in v0.5.0

type SigningKeyPhase string

SigningKeyPhase is where a signing key rotation is. +kubebuilder:validation:Enum=Idle;Publishing;Retiring

const (
	// SigningKeyIdle: one key, which signs.
	SigningKeyIdle SigningKeyPhase = "Idle"
	// SigningKeyPublishing: the next key is published to the engines; the
	// active one still signs.
	SigningKeyPublishing SigningKeyPhase = "Publishing"
	// SigningKeyRetiring: the new key signs; the previous one stays trusted
	// until every engine runs a bundle the new one signed.
	SigningKeyRetiring SigningKeyPhase = "Retiring"
)

The phases of a signing key rotation.

type SigningKeySpec added in v0.1.1

type SigningKeySpec struct {
	// RotationInterval rotates the signing key once it has signed for this
	// long, e.g. 2160h (90 days); at least 1h. Empty: the key rotates only
	// when requested with the waf.inkwall.dev/rotate-signing-key
	// annotation.
	// +kubebuilder:validation:XValidation:rule="duration(self) >= duration('1h')",message="rotationInterval must be at least 1h"
	// +optional
	RotationInterval *metav1.Duration `json:"rotationInterval,omitempty"`
}

SigningKeySpec configures the bundle signing key.

func (*SigningKeySpec) DeepCopy added in v0.1.1

func (in *SigningKeySpec) DeepCopy() *SigningKeySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SigningKeySpec.

func (*SigningKeySpec) DeepCopyInto added in v0.1.1

func (in *SigningKeySpec) DeepCopyInto(out *SigningKeySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SigningKeyStatus added in v0.5.0

type SigningKeyStatus struct {
	// ActiveKeyID is the ID of the key that signs bundles.
	// +kubebuilder:validation:MaxLength=128
	ActiveKeyID string `json:"activeKeyID"`

	// Phase of the rotation. New phases may be added: to wait for a
	// rotation, watch the SigningKeyRotation condition instead.
	Phase SigningKeyPhase `json:"phase"`

	// Since is when the phase began (Publishing, Retiring), or when the
	// active key began to sign (Idle).
	// +optional
	Since *metav1.Time `json:"since,omitempty"`

	// WaitingFor says what the rotation waits for; empty when it waits for
	// nothing.
	// +kubebuilder:validation:MaxLength=1024
	// +optional
	WaitingFor string `json:"waitingFor,omitempty"`
}

SigningKeyStatus describes the bundle signing key.

func (*SigningKeyStatus) DeepCopy added in v0.5.0

func (in *SigningKeyStatus) DeepCopy() *SigningKeyStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SigningKeyStatus.

func (*SigningKeyStatus) DeepCopyInto added in v0.5.0

func (in *SigningKeyStatus) DeepCopyInto(out *SigningKeyStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SinkTLS

type SinkTLS struct {
	// CASecretRef names a Secret in the operator's namespace whose ca.crt
	// holds the CAs trusted for the server. Unset: the system roots.
	// +optional
	CASecretRef *LocalSecretReference `json:"caSecretRef,omitempty"`

	// ClientCertificateSecretRef names a kubernetes.io/tls Secret in the
	// operator's namespace: the client certificate for mutual TLS.
	// +optional
	ClientCertificateSecretRef *LocalSecretReference `json:"clientCertificateSecretRef,omitempty"`

	// ServerName is the name checked in the server's certificate. Unset:
	// the endpoint's host.
	// +kubebuilder:validation:MaxLength=253
	// +kubebuilder:validation:Pattern=`^[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?(\.[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?)*$`
	// +optional
	ServerName string `json:"serverName,omitempty"`
}

SinkTLS configures a sink's TLS: version 1.2 or later, the server's certificate always verified.

func (*SinkTLS) DeepCopy

func (in *SinkTLS) DeepCopy() *SinkTLS

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SinkTLS.

func (*SinkTLS) DeepCopyInto

func (in *SinkTLS) DeepCopyInto(out *SinkTLS)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SkipSpec

type SkipSpec struct {
	// Paths that are never inspected. A set: a path listed twice draws a
	// warning, and v1 refuses it.
	// +kubebuilder:validation:MaxItems=64
	// +listType=atomic
	// +optional
	Paths []PathPattern `json:"paths,omitempty"`

	// BodyPaths are paths whose body is not inspected; their headers and URI
	// still are. A set: a path listed twice draws a warning, and v1 refuses
	// it.
	// +kubebuilder:validation:MaxItems=64
	// +listType=atomic
	// +optional
	BodyPaths []PathPattern `json:"bodyPaths,omitempty"`
}

SkipSpec lists requests that are never inspected.

func (*SkipSpec) DeepCopy

func (in *SkipSpec) DeepCopy() *SkipSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SkipSpec.

func (*SkipSpec) DeepCopyInto

func (in *SkipSpec) DeepCopyInto(out *SkipSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StreamsAction added in v0.6.0

type StreamsAction string

StreamsAction is whether streamed responses are inspected event by event. +kubebuilder:validation:Enum=Inspect;Skip

const (
	// StreamsInspect inspects each event of a Server-Sent Events stream
	// and each message of a gRPC response on its own.
	StreamsInspect StreamsAction = "Inspect"
	// StreamsSkip inspects a stream's status and headers only.
	StreamsSkip StreamsAction = "Skip"
)

type Support added in v0.3.0

type Support string

Support is how far Inkwall wires a proxy controller's routes (0004 §4.1). +kubebuilder:validation:Enum=Full;Partial;Unsupported

const (
	// SupportFull: Inkwall wires the routes of every class of the
	// controller.
	SupportFull Support = "Full"
	// SupportPartial: it wires those of some of its classes; the message
	// says which aren't.
	SupportPartial Support = "Partial"
	// SupportUnsupported: it wires none; a policy on one of its routes is
	// not Programmed (ControllerUnsupported).
	SupportUnsupported Support = "Unsupported"
)

The support levels.

type TargetRef

type TargetRef struct {
	// Group of the target: networking.k8s.io (the default, for Ingress),
	// gateway.networking.k8s.io (for HTTPRoute), traefik.io (for Traefik's
	// IngressRoute) or networking.istio.io (for Istio's VirtualService).
	// +kubebuilder:validation:MaxLength=253
	// +optional
	Group string `json:"group,omitempty"`

	// Kind of the target: Ingress, HTTPRoute, IngressRoute or
	// VirtualService. An
	// IngressRoute's hosts and paths come from its routes' match rules,
	// which may combine Host, Path and PathPrefix with &&; a rule with
	// anything else (||, !, other matchers) is not accepted. An HTTPRoute's routes
	// are each of its hostnames (none: any host) with each of its rules'
	// matches, which may have an Exact or PathPrefix path and a method; a
	// match with a RegularExpression path, headers or queryParams is not
	// accepted. A VirtualService's routes are each of its hosts ("*": any
	// host) with each of its http routes' matches, which may have an exact
	// or prefix uri and an exact method; a match with anything else (a regex
	// uri, headers, query parameters, ...), a delegate, or a short host name
	// is not accepted. Whether a proxy wires HTTPRoute targets depends
	// on its integration; VirtualService targets are wired through Istio's
	// ingress gateways.
	// +kubebuilder:validation:Enum=Ingress;HTTPRoute;IngressRoute;VirtualService
	Kind string `json:"kind"`

	// Name of the target.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	Name string `json:"name"`

	// SectionName narrows an HTTPRoute target to the rule of that name:
	// only its matches are protected, and it takes precedence over a policy
	// on the whole HTTPRoute. A name no rule has is a missing target.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	// +optional
	SectionName string `json:"sectionName,omitempty"`
}

TargetRef names a route in the policy's namespace. +kubebuilder:validation:XValidation:rule="(self.kind == 'Ingress' && (!has(self.group) || self.group == 'networking.k8s.io')) || (self.kind == 'HTTPRoute' && has(self.group) && self.group == 'gateway.networking.k8s.io') || (self.kind == 'IngressRoute' && has(self.group) && self.group == 'traefik.io') || (self.kind == 'VirtualService' && has(self.group) && self.group == 'networking.istio.io')",message="target must be a networking.k8s.io Ingress, a gateway.networking.k8s.io HTTPRoute, a traefik.io IngressRoute or a networking.istio.io VirtualService" +kubebuilder:validation:XValidation:rule="!has(self.sectionName) || self.kind == 'HTTPRoute'",message="sectionName is only allowed for an HTTPRoute"

func (*TargetRef) DeepCopy

func (in *TargetRef) DeepCopy() *TargetRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetRef.

func (*TargetRef) DeepCopyInto

func (in *TargetRef) DeepCopyInto(out *TargetRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WAFIPList added in v0.5.0

type WAFIPList struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec WAFIPListSpec `json:"spec"`
	// +optional
	Status WAFIPListStatus `json:"status,omitempty"`
}

WAFIPList is a list of client addresses that WAFPolicies in its namespace allow or deny (spec.ipLists). The client address is the one the engine resolves: see docs/client-ip.md.

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=inkwall,shortName=wafip +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*WAFIPList) DeepCopy added in v0.5.0

func (in *WAFIPList) DeepCopy() *WAFIPList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFIPList.

func (*WAFIPList) DeepCopyInto added in v0.5.0

func (in *WAFIPList) DeepCopyInto(out *WAFIPList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*WAFIPList) DeepCopyObject added in v0.5.0

func (in *WAFIPList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type WAFIPListList added in v0.5.0

type WAFIPListList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []WAFIPList `json:"items"`
}

WAFIPListList is a list of WAFIPList.

+kubebuilder:object:root=true

func (*WAFIPListList) DeepCopy added in v0.5.0

func (in *WAFIPListList) DeepCopy() *WAFIPListList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFIPListList.

func (*WAFIPListList) DeepCopyInto added in v0.5.0

func (in *WAFIPListList) DeepCopyInto(out *WAFIPListList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*WAFIPListList) DeepCopyObject added in v0.5.0

func (in *WAFIPListList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type WAFIPListSpec added in v0.5.0

type WAFIPListSpec struct {
	// Entries are the list's addresses and prefixes. Required. Up to
	// 10,000, but the object must also fit etcd's request limit (1.5 MiB by
	// default): 10,000 entries fit without descriptions, about 4,500 with
	// 256-byte ones; split a longer list into several WAFIPLists. A CIDR
	// listed twice draws a warning: v1 keys the entries by cidr
	// (listType=map) and refuses it.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=10000
	// +listType=atomic
	// +optional
	Entries []IPListEntry `json:"entries,omitempty"`
}

WAFIPListSpec is a list of client addresses. +kubebuilder:validation:XValidation:rule="has(self.entries)",message="entries is required"

func (*WAFIPListSpec) DeepCopy added in v0.5.0

func (in *WAFIPListSpec) DeepCopy() *WAFIPListSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFIPListSpec.

func (*WAFIPListSpec) DeepCopyInto added in v0.5.0

func (in *WAFIPListSpec) DeepCopyInto(out *WAFIPListSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WAFIPListStatus

type WAFIPListStatus struct {
	// ObservedGeneration is the generation the status describes.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Conditions describe the list's state: Accepted is True when every
	// entry parses as the engine parses it, and False (InvalidEntries)
	// naming the first that doesn't; the policies that use the list are
	// then not Accepted either.
	// +listType=map
	// +listMapKey=type
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

WAFIPListStatus says whether the list is usable.

func (*WAFIPListStatus) DeepCopy

func (in *WAFIPListStatus) DeepCopy() *WAFIPListStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFIPListStatus.

func (*WAFIPListStatus) DeepCopyInto

func (in *WAFIPListStatus) DeepCopyInto(out *WAFIPListStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WAFPolicy

type WAFPolicy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec WAFPolicySpec `json:"spec"`
	// +optional
	Status WAFPolicyStatus `json:"status,omitempty"`
}

WAFPolicy protects routes: which rules run, in which mode, and what happens when inspection fails.

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=inkwall,shortName=wafp +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode` +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status` +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason` +kubebuilder:printcolumn:name="Bundle",type=integer,JSONPath=`.status.bundleVersion` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*WAFPolicy) DeepCopy

func (in *WAFPolicy) DeepCopy() *WAFPolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicy.

func (*WAFPolicy) DeepCopyInto

func (in *WAFPolicy) DeepCopyInto(out *WAFPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*WAFPolicy) DeepCopyObject

func (in *WAFPolicy) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type WAFPolicyList

type WAFPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []WAFPolicy `json:"items"`
}

WAFPolicyList is a list of WAFPolicy.

+kubebuilder:object:root=true

func (*WAFPolicyList) DeepCopy

func (in *WAFPolicyList) DeepCopy() *WAFPolicyList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicyList.

func (*WAFPolicyList) DeepCopyInto

func (in *WAFPolicyList) DeepCopyInto(out *WAFPolicyList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*WAFPolicyList) DeepCopyObject

func (in *WAFPolicyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type WAFPolicySpec

type WAFPolicySpec struct {
	// TargetRefs are the routes this policy protects, in the policy's
	// namespace.
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=16
	// +kubebuilder:validation:XValidation:rule="self.all(a, self.exists_one(b, b.kind == a.kind && b.name == a.name && (has(b.sectionName) ? b.sectionName : ”) == (has(a.sectionName) ? a.sectionName : ”)))",message="targetRefs must not repeat a target"
	// +listType=atomic
	TargetRefs []TargetRef `json:"targetRefs"`

	// Mode is Detect (log, let through) or Block (reject).
	// +kubebuilder:default=Detect
	// +optional
	Mode PolicyMode `json:"mode,omitempty"`

	// FailureMode is what happens to a request that can't be inspected in
	// time. Unset: Closed in Block mode, Open in Detect mode.
	// +optional
	FailureMode FailureMode `json:"failureMode,omitempty"`

	// Timeout is the inspection deadline per request, at most 1s.
	// +kubebuilder:default="250ms"
	// +kubebuilder:validation:XValidation:rule="duration(self) > duration('0s') && duration(self) <= duration('1s')",message="timeout must be more than 0s and at most 1s"
	// +optional
	Timeout *metav1.Duration `json:"timeout,omitempty"`

	// Skip lists requests that are never inspected.
	// +optional
	Skip *SkipSpec `json:"skip,omitempty"`

	// RuleSets are the rules to run, in order. Empty: the built-in OWASP CRS
	// with its default paranoia level and threshold.
	// +kubebuilder:validation:MaxItems=8
	// +optional
	// +listType=atomic
	RuleSets []RuleSetBinding `json:"ruleSets,omitempty"`

	// Exclusions turn rules off where they cause false positives.
	// +kubebuilder:validation:MaxItems=128
	// +optional
	// +listType=atomic
	Exclusions []Exclusion `json:"exclusions,omitempty"`

	// Body configures request body inspection.
	// +optional
	Body *BodySpec `json:"body,omitempty"`

	// WebSocket is what a WebSocket handshake on the policy's routes must
	// meet, on top of the rules: the origins it may come from, the headers
	// it must have. A handshake that doesn't is denied with 403 in Block
	// mode (logged in Detect mode), and isn't upgraded. Other requests
	// aren't affected. The handshake's URL and headers are inspected by
	// the rules whether this is set or not; the messages after it are not
	// inspected (docs/websocket.md). Engines before 0.4.0 ignore it: the
	// policy isn't Enforced while one is connected.
	// +optional
	WebSocket *WebSocketSpec `json:"webSocket,omitempty"`

	// Responses configures response inspection, for data leaks (the CRS's
	// RESPONSE-95x rules, and the rule sets' rules on RESPONSE_*
	// variables). Unset: responses are not inspected. Envoy Gateway,
	// Istio and the HAProxy Kubernetes Ingress Controller (once its pods
	// run an engine of 0.6.0 or later) send responses to the engine; on a
	// route of Traefik (its ForwardAuth can't), or of HAProxy before then,
	// the policy is not Programmed (ResponsesNotInspected).
	// +optional
	Responses *ResponsesSpec `json:"responses,omitempty"`

	// IPLists names WAFIPLists in the policy's namespace whose client
	// addresses are denied, or let through uninspected. A deny list wins
	// over an allow list. They are only as good as the client IP the
	// engine resolves (docs/client-ip.md). Requires engines 0.5.0 or
	// later.
	// +optional
	IPLists *IPListsSpec `json:"ipLists,omitempty"`

	// RateLimits limit how many requests a client may send, per engine:
	// over a limit, a request is denied with 429 and Retry-After before the
	// rules (logged in Detect mode). Each engine counts on its own, so a
	// client spread over N engines gets up to N times the limit
	// (docs/rate-limits.md). Clients in an IP allow list, and skipped
	// paths, are never counted. Requires engines 0.7.0 or later.
	// +kubebuilder:validation:MaxItems=8
	// +kubebuilder:validation:XValidation:rule="self.all(a, self.exists_one(b, b.name == a.name))",message="rateLimits must not repeat a name"
	// +optional
	// +listType=atomic
	RateLimits []RateLimit `json:"rateLimits,omitempty"`

	// DenyResponse is the body of the policy's denials (by a rule, an IP
	// list, the WebSocket or gRPC checks, a rate limit, a request that
	// couldn't be inspected in time, a response replaced), instead of the
	// engine's own text, with the denial's status. Unset: the
	// InkwallConfig's spec.engine.denyResponse, if set. Through Traefik,
	// Envoy Gateway, Istio and the engine's check API; HAProxy writes its
	// own denials. Requires engines 0.7.0 or later.
	// +optional
	DenyResponse *DenyResponse `json:"denyResponse,omitempty"`

	// Geo denies clients by country, or lets only some countries in
	// (docs/geo-blocking.md), checked after the IP lists, before the
	// skipped paths, the rate limits and the rules. It needs a country
	// database (InkwallConfig spec.geo.database), and is only as right as
	// the client IP the engine resolves (docs/client-ip.md). Requires
	// engines 0.7.0 or later.
	// +optional
	Geo *GeoSpec `json:"geo,omitempty"`

	// LLM declares paths of the policy's routes as LLM APIs (OpenAI Chat
	// Completions, Responses or Embeddings, Anthropic Messages): their
	// request bodies are read up to maxBodyBytes, parsed strictly, and
	// checked natively (the model, the prompt's size, the messages, the
	// output limit, the roles and tools a client sends). A body that
	// doesn't parse one way, or fails a check, is denied with 400 (413 for
	// the size caps) in Block mode. The rule sets skip these bodies unless
	// ruleSetBody is Inspect. Requires engines 0.7.0 or later
	// (docs/llm-apis.md).
	// +optional
	LLM *LLMSpec `json:"llm,omitempty"`
}

WAFPolicySpec is what to enforce on which routes. +kubebuilder:validation:XValidation:rule="has(self.llm) || !has(self.rateLimits) || self.rateLimits.all(l, !has(l.cost) || l.cost != 'LLMTokens')",message="a rate limit with cost: LLMTokens needs spec.llm"

func (*WAFPolicySpec) DeepCopy

func (in *WAFPolicySpec) DeepCopy() *WAFPolicySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicySpec.

func (*WAFPolicySpec) DeepCopyInto

func (in *WAFPolicySpec) DeepCopyInto(out *WAFPolicySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WAFPolicyStatus

type WAFPolicyStatus struct {
	// ObservedGeneration is the generation the status describes.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// BundleVersion is the first bundle that enforces this generation as it
	// is now: later bundles do too, until one changes the policy (its
	// spec, routes or rule sets) or suspends the cluster. Bundles that
	// change only other policies leave it.
	// +optional
	BundleVersion int64 `json:"bundleVersion,omitempty"`

	// Conditions are Accepted, Programmed, Enforced and Ready.
	// +listType=map
	// +listMapKey=type
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

WAFPolicyStatus reports how far the policy got: accepted, programmed into the proxy, enforced by every engine (0004 §3.2).

func (*WAFPolicyStatus) DeepCopy

func (in *WAFPolicyStatus) DeepCopy() *WAFPolicyStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicyStatus.

func (*WAFPolicyStatus) DeepCopyInto

func (in *WAFPolicyStatus) DeepCopyInto(out *WAFPolicyStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WAFRuleSet

type WAFRuleSet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec WAFRuleSetSpec `json:"spec"`
	// +optional
	Status RuleSetStatus `json:"status,omitempty"`
}

WAFRuleSet is a set of rules that policies in its namespace can use.

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=inkwall,shortName=wafrs +kubebuilder:printcolumn:name="Builtin",type=string,JSONPath=`.spec.source.builtin` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*WAFRuleSet) DeepCopy

func (in *WAFRuleSet) DeepCopy() *WAFRuleSet

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFRuleSet.

func (*WAFRuleSet) DeepCopyInto

func (in *WAFRuleSet) DeepCopyInto(out *WAFRuleSet)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*WAFRuleSet) DeepCopyObject

func (in *WAFRuleSet) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type WAFRuleSetList

type WAFRuleSetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []WAFRuleSet `json:"items"`
}

WAFRuleSetList is a list of WAFRuleSet.

+kubebuilder:object:root=true

func (*WAFRuleSetList) DeepCopy

func (in *WAFRuleSetList) DeepCopy() *WAFRuleSetList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFRuleSetList.

func (*WAFRuleSetList) DeepCopyInto

func (in *WAFRuleSetList) DeepCopyInto(out *WAFRuleSetList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*WAFRuleSetList) DeepCopyObject

func (in *WAFRuleSetList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type WAFRuleSetSpec

type WAFRuleSetSpec struct {
	// Source of the rules.
	Source RuleSetSource `json:"source"`
}

WAFRuleSetSpec defines a namespaced rule set.

func (*WAFRuleSetSpec) DeepCopy

func (in *WAFRuleSetSpec) DeepCopy() *WAFRuleSetSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFRuleSetSpec.

func (*WAFRuleSetSpec) DeepCopyInto

func (in *WAFRuleSetSpec) DeepCopyInto(out *WAFRuleSetSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WebSocketOrigin added in v0.4.0

type WebSocketOrigin string

WebSocketOrigin is an origin, "scheme://host[:port]", lower case; the host may start with "*." to match subdomains. +kubebuilder:validation:MaxLength=270 +kubebuilder:validation:Pattern=`^https?://(\*\.)?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*(:[0-9]{1,5})?$`

type WebSocketSpec added in v0.4.0

type WebSocketSpec struct {
	// AllowedOrigins are the origins a handshake may come from, against
	// cross-site WebSocket hijacking: a page on another site can open a
	// WebSocket to the application with the user's cookies, and only the
	// Origin header tells. Each is "scheme://host" or "scheme://host:port",
	// lower case, with scheme http or https; a host "*.example.com"
	// matches any subdomain of example.com, not example.com itself. A
	// handshake without Origin is denied unless allowMissingOrigin is set.
	// Empty: any origin.
	// +kubebuilder:validation:MaxItems=64
	// +listType=set
	// +optional
	AllowedOrigins []WebSocketOrigin `json:"allowedOrigins,omitempty"`

	// AllowMissingOrigin lets a handshake without an Origin header pass
	// the origin check. Browsers always send Origin; other clients (a
	// mobile app, a service) may not, and aren't the target of cross-site
	// hijacking.
	// +optional
	AllowMissingOrigin bool `json:"allowMissingOrigin,omitempty"`

	// RequiredHeaders are headers a handshake must have, not empty: a
	// token (Authorization), a subprotocol (Sec-WebSocket-Protocol). Their
	// values aren't checked.
	// +kubebuilder:validation:MaxItems=16
	// +listType=set
	// +optional
	RequiredHeaders []HeaderName `json:"requiredHeaders,omitempty"`
}

WebSocketSpec is what a WebSocket handshake must meet. +kubebuilder:validation:XValidation:rule="!has(self.allowMissingOrigin) || !self.allowMissingOrigin || (has(self.allowedOrigins) && size(self.allowedOrigins) > 0)",message="allowMissingOrigin needs allowedOrigins"

func (*WebSocketSpec) DeepCopy added in v0.4.0

func (in *WebSocketSpec) DeepCopy() *WebSocketSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebSocketSpec.

func (*WebSocketSpec) DeepCopyInto added in v0.4.0

func (in *WebSocketSpec) DeepCopyInto(out *WebSocketSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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