@@ -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,39 @@ 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. Blank or whitespace-only entries are rejected,
278+ // as they would otherwise match every path and disable the sandbox.
279+ //
280+ // +kubebuilder:validation:MaxItems=64
281+ // +kubebuilder:validation:items:MinLength=1
282+ // +kubebuilder:validation:items:MaxLength=4096
283+ // +kubebuilder:validation:XValidation:rule="self.all(p, p.trim() != '')",message="allowedPaths entries must not be blank or whitespace-only"
284+ // +optional
285+ AllowedPaths []string `json:"allowedPaths,omitempty"`
286+
287+ // AllowedEnvVars is the list of environment variable names that Lua scripts are permitted to
288+ // access during validation (via os.getenv, os.setenv). Matching is exact and case-sensitive.
289+ // When empty, access to all environment variables is denied. Blank or whitespace-only entries
290+ // are rejected.
291+ //
292+ // +kubebuilder:validation:MaxItems=64
293+ // +kubebuilder:validation:items:MinLength=1
294+ // +kubebuilder:validation:items:MaxLength=256
295+ // +kubebuilder:validation:XValidation:rule="self.all(e, e.trim() != '')",message="allowedEnvVars entries must not be blank or whitespace-only"
296+ // +optional
297+ AllowedEnvVars []string `json:"allowedEnvVars,omitempty"`
298+ }
299+
253300// RoutingType defines the type of routing of this Envoy proxy.
254301type RoutingType string
255302
0 commit comments