@@ -189,6 +189,20 @@ type EnvoyProxySpec struct {
189189 // +optional
190190 LuaValidation * LuaValidation `json:"luaValidation,omitempty"`
191191
192+ // LuaValidationAllowlist defines the filesystem paths and environment variables that Lua
193+ // scripts from EnvoyExtensionPolicy resources are permitted to access during Strict
194+ // validation in the gateway controller.
195+ //
196+ // The allowlist is fail-closed: when unset or empty, Lua scripts are denied access to ALL
197+ // filesystem paths and environment variables during validation. Only entries that match the
198+ // allowlist are permitted.
199+ //
200+ // This field only takes effect when LuaValidation is Strict (the default). It has no effect
201+ // for the InsecureSyntax or Disabled validation modes, which do not execute the security sandbox.
202+ //
203+ // +optional
204+ LuaValidationAllowlist * LuaValidationAllowlist `json:"luaValidationAllowlist,omitempty"`
205+
192206 // DynamicModules defines the set of dynamic modules that are allowed to be
193207 // used by EnvoyExtensionPolicy resources and dynamic module load balancer
194208 // policies. Each entry registers a module by a logical name and specifies
@@ -250,6 +264,31 @@ const (
250264 LuaValidationDisabled LuaValidation = "Disabled"
251265)
252266
267+ // LuaValidationAllowlist defines the filesystem paths and environment variables that Lua scripts
268+ // are permitted to access during Strict Lua validation in the gateway controller.
269+ // The allowlist is fail-closed: access to any path or environment variable that does not match an
270+ // entry below is denied.
271+ type LuaValidationAllowlist struct {
272+ // AllowedPaths is the list of filesystem path prefixes that Lua scripts are permitted to
273+ // access during validation (via io.open, io.input, io.output, io.lines, os.remove, os.rename).
274+ // A path is allowed when it equals an entry or is contained within an entry's subtree
275+ // (e.g. "/tmp" allows "/tmp/file.txt"). Paths are normalized (separators collapsed, made
276+ // absolute) before matching, and any "." or ".." traversal segment is always rejected.
277+ // When empty, all filesystem access is denied.
278+ //
279+ // +kubebuilder:validation:MaxItems=64
280+ // +optional
281+ AllowedPaths []string `json:"allowedPaths,omitempty"`
282+
283+ // AllowedEnvVars is the list of environment variable names that Lua scripts are permitted to
284+ // access during validation (via os.getenv, os.setenv). Matching is exact and case-sensitive.
285+ // When empty, access to all environment variables is denied.
286+ //
287+ // +kubebuilder:validation:MaxItems=64
288+ // +optional
289+ AllowedEnvVars []string `json:"allowedEnvVars,omitempty"`
290+ }
291+
253292// RoutingType defines the type of routing of this Envoy proxy.
254293type RoutingType string
255294
0 commit comments