Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions api/v1alpha1/envoyproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,27 @@ type EnvoyProxySpec struct {
// +optional
PreserveRouteOrder *bool `json:"preserveRouteOrder,omitempty"`

// DisableLuaValidation disables the Lua script validation for Lua EnvoyExtensionPolicies
// +kubebuilder:default=false
// LuaValidation determines strictness of the Lua script validation for Lua EnvoyExtensionPolicies
// Default: Strict
// +optional
DisableLuaValidation *bool `json:"disableLuaValidation,omitempty"`
LuaValidation *LuaValidation `json:"luaValidation,omitempty"`
}

// +kubebuilder:validation:Enum=Strict;Disabled
type LuaValidation string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would it make sense to name it LuaValidationLevel?


const (
// LuaValidationStrict is the default level and checks for issues during script execution.
// Recommended if your scripts only use the standard Envoy Lua stream handle API.
// For supported APIs, see: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter#stream-handle-api
LuaValidationStrict LuaValidation = "Strict"

// LuaValidationDisabled disables all validation of Lua scripts.
// Scripts will be accepted and executed without any validation checks.
// This is not recommended unless your scripts import libraries that are not supported by Lua runtime validation.
LuaValidationDisabled LuaValidation = "Disabled"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a line in here mentioning when its needed, e.g. when importing libraries

Copy link
Member Author

@rudrakhp rudrakhp Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Will update once we have the Syntax enum implemented.

)

// RoutingType defines the type of routing of this Envoy proxy.
type RoutingType string

Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,6 @@ spec:
the number of cpuset threads on the platform.
format: int32
type: integer
disableLuaValidation:
default: false
description: DisableLuaValidation disables the Lua script validation
for Lua EnvoyExtensionPolicies
type: boolean
extraArgs:
description: |-
ExtraArgs defines additional command line options that are provided to Envoy.
Expand Down Expand Up @@ -442,6 +437,14 @@ spec:
and the log level is the value. If unspecified, defaults to "default: warn".
type: object
type: object
luaValidation:
description: |-
LuaValidation determines strictness of the Lua script validation for Lua EnvoyExtensionPolicies
Default: Strict
enum:
- Strict
- Disabled
type: string
mergeGateways:
description: |-
MergeGateways defines if Gateway resources should be merged onto the same Envoy Proxy Infrastructure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,6 @@ spec:
the number of cpuset threads on the platform.
format: int32
type: integer
disableLuaValidation:
default: false
description: DisableLuaValidation disables the Lua script validation
for Lua EnvoyExtensionPolicies
type: boolean
extraArgs:
description: |-
ExtraArgs defines additional command line options that are provided to Envoy.
Expand Down Expand Up @@ -441,6 +436,14 @@ spec:
and the log level is the value. If unspecified, defaults to "default: warn".
type: object
type: object
luaValidation:
description: |-
LuaValidation determines strictness of the Lua script validation for Lua EnvoyExtensionPolicies
Default: Strict
enum:
- Strict
- Disabled
type: string
mergeGateways:
description: |-
MergeGateways defines if Gateway resources should be merged onto the same Envoy Proxy Infrastructure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ envoyProxyForGatewayClass:
socket_address:
address: 127.0.0.1
port_value: 19000
disableLuaValidation: false
logging:
level:
default: warn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ envoyProxyForGatewayClass:
name: example
namespace: default
spec:
disableLuaValidation: false
logging:
level:
default: warn
Expand Down
3 changes: 2 additions & 1 deletion internal/gatewayapi/envoyextensionpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ func (t *Translator) buildLua(
if err != nil {
return nil, err
}
if envoyProxy != nil && envoyProxy.Spec.DisableLuaValidation != nil && *envoyProxy.Spec.DisableLuaValidation {
if envoyProxy != nil && envoyProxy.Spec.LuaValidation != nil &&
*envoyProxy.Spec.LuaValidation == egv1a1.LuaValidationDisabled {
return &ir.Lua{
Name: name,
Code: luaCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ envoyProxyForGatewayClass:
name: example
namespace: default
spec:
disableLuaValidation: false
logging:
level:
default: warn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ envoyProxyForGatewayClass:
namespace: envoy-gateway-system
name: test
spec:
disableLuaValidation: true
luaValidation: Disabled
gateways:
- apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ infraIR:
name: test
namespace: envoy-gateway-system
spec:
disableLuaValidation: true
logging: {}
luaValidation: Disabled
status: {}
listeners:
- address: null
Expand Down
3 changes: 1 addition & 2 deletions release-notes/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ new features: |
Added support for specifying deployment annotations through the helm chart.
Added support for customizing the name of the ServiceAccount used by the Proxy.
Added support for custom backendRefs via extension server using PostClusterModify hook.


Introduce validation strictness levels for Lua scripts in EnvoyExtensionPolicies.
bug fixes: |
Handle integer zone annotation values
Fixed issue where WASM cache init failure caused routes with WASM-less EnvoyExtensionPolicies to have 500 direct responses.
Expand Down
17 changes: 16 additions & 1 deletion site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ _Appears in:_
| `backendTLS` | _[BackendTLSConfig](#backendtlsconfig)_ | false | | BackendTLS is the TLS configuration for the Envoy proxy to use when connecting to backends.<br />These settings are applied on backends for which TLS policies are specified. |
| `ipFamily` | _[IPFamily](#ipfamily)_ | false | | IPFamily specifies the IP family for the EnvoyProxy fleet.<br />This setting only affects the Gateway listener port and does not impact<br />other aspects of the Envoy proxy configuration.<br />If not specified, the system will operate as follows:<br />- It defaults to IPv4 only.<br />- IPv6 and dual-stack environments are not supported in this default configuration.<br />Note: To enable IPv6 or dual-stack functionality, explicit configuration is required. |
| `preserveRouteOrder` | _boolean_ | false | | PreserveRouteOrder determines if the order of matching for HTTPRoutes is determined by Gateway-API<br />specification (https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.HTTPRouteRule)<br />or preserves the order defined by users in the HTTPRoute's HTTPRouteRule list.<br />Default: False |
| `disableLuaValidation` | _boolean_ | false | false | DisableLuaValidation disables the Lua script validation for Lua EnvoyExtensionPolicies |
| `luaValidation` | _[LuaValidation](#luavalidation)_ | false | | LuaValidation determines strictness of the Lua script validation for Lua EnvoyExtensionPolicies<br />Default: Strict |


#### EnvoyProxyStatus
Expand Down Expand Up @@ -3154,6 +3154,21 @@ _Appears in:_
| `valueRef` | _[LocalObjectReference](#localobjectreference)_ | false | | ValueRef has the source code specified as a local object reference.<br />Only a reference to ConfigMap is supported.<br />The value of key `lua` in the ConfigMap will be used.<br />If the key is not found, the first value in the ConfigMap will be used. |


#### LuaValidation

_Underlying type:_ _string_



_Appears in:_
- [EnvoyProxySpec](#envoyproxyspec)

| Value | Description |
| ----- | ----------- |
| `Strict` | LuaValidationStrict is the default level and checks for issues during script execution.<br />Recommended if your scripts only use the standard Envoy Lua stream handle API.<br />For supported APIs, see: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter#stream-handle-api<br /> |
| `Disabled` | LuaValidationDisabled disables all validation of Lua scripts.<br />Scripts will be accepted and executed without any validation checks.<br />This is not recommended unless your scripts import libraries that are not supported by Lua runtime validation.<br /> |


#### LuaValueType

_Underlying type:_ _string_
Expand Down
13 changes: 8 additions & 5 deletions test/helm/gateway-crds-helm/all.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24078,11 +24078,6 @@ spec:
the number of cpuset threads on the platform.
format: int32
type: integer
disableLuaValidation:
default: false
description: DisableLuaValidation disables the Lua script validation
for Lua EnvoyExtensionPolicies
type: boolean
extraArgs:
description: |-
ExtraArgs defines additional command line options that are provided to Envoy.
Expand Down Expand Up @@ -24250,6 +24245,14 @@ spec:
and the log level is the value. If unspecified, defaults to "default: warn".
type: object
type: object
luaValidation:
description: |-
LuaValidation determines strictness of the Lua script validation for Lua EnvoyExtensionPolicies
Default: Strict
enum:
- Strict
- Disabled
type: string
mergeGateways:
description: |-
MergeGateways defines if Gateway resources should be merged onto the same Envoy Proxy Infrastructure.
Expand Down
13 changes: 8 additions & 5 deletions test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6766,11 +6766,6 @@ spec:
the number of cpuset threads on the platform.
format: int32
type: integer
disableLuaValidation:
default: false
description: DisableLuaValidation disables the Lua script validation
for Lua EnvoyExtensionPolicies
type: boolean
extraArgs:
description: |-
ExtraArgs defines additional command line options that are provided to Envoy.
Expand Down Expand Up @@ -6938,6 +6933,14 @@ spec:
and the log level is the value. If unspecified, defaults to "default: warn".
type: object
type: object
luaValidation:
description: |-
LuaValidation determines strictness of the Lua script validation for Lua EnvoyExtensionPolicies
Default: Strict
enum:
- Strict
- Disabled
type: string
mergeGateways:
description: |-
MergeGateways defines if Gateway resources should be merged onto the same Envoy Proxy Infrastructure.
Expand Down