Skip to content

Commit 62f68be

Browse files
Auto: sync API from tigera/calico-private [master] (#259)
Automated sync of API files from `tigera/calico-private` `master` branch into this repo via `make -f Makefile.local update`. Triggered by scheduled workflow.
2 parents 1e43c4e + 16652ed commit 62f68be

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

config/crd/applicationlayer.projectcalico.org_wafpolicies.yaml

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/applicationlayer.projectcalico.org/v3/types.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,20 @@ type WAFPolicySpec struct {
313313
// If not specified, inherits from GlobalWAFPolicy
314314
CoreRuleSet *CoreRuleSetConfig `json:"coreRuleSet,omitempty"`
315315

316-
// Plugins references WAFPlugins in this namespace
316+
// Plugins references WAFPlugins in this namespace. A cross-scope reference
317+
// (kind: GlobalWAFPlugin) is rejected at admission by the CEL rule below and
318+
// the validating webhook, because the reconciler resolves plugin scope from
319+
// the parent policy and does not yet honor Kind. See EV-6753.
320+
//
321+
// Only this namespaced direction is guarded. The mirror case, a
322+
// GlobalWAFPolicy referencing a namespaced WAFPlugin, is intentionally not
323+
// guarded: PluginRef.Kind defaults to WAFPlugin (see above), so a symmetric
324+
// rule would reject that default on nearly every GlobalWAFPolicy. The
325+
// cross-scope-resolution follow-up owns the reverse guard, the Kind default,
326+
// and an upgrade migration; see the WAF controllers README.
317327
// +kubebuilder:validation:MaxItems=64
318-
Plugins []PluginRef `json:"plugins,omitempty"`
328+
// +kubebuilder:validation:XValidation:rule="self.all(p, !has(p.kind) || p.kind != 'GlobalWAFPlugin')",message="cross-scope plugin references are not yet supported: a namespaced WAFPolicy cannot reference a GlobalWAFPlugin"
329+
Plugins []PluginRef `json:"plugins,omitempty"` // rule's !has(p.kind) is defensive: Kind is defaulted to WAFPlugin upstream, so an empty Kind never reaches CEL today.
319330
}
320331

321332
// RenderedConfigMapRef identifies the ConfigMap into which the controller

0 commit comments

Comments
 (0)