Legacy cherrypick (#7925)
* fix: fix thread synchronization issue #6245 (#7800) * Add option to sanitize annotation inputs (#7874) * Add option to sanitize annotation inputs * Fix e2e tests after string sanitization * Add proxy_pass and serviceaccount as denied values * Trim spaces from badword items (#7921) * Fix tests from cherrypick Co-authored-by: Jens Reimann <ctron@dentrassi.de>
This commit is contained in:
parent
3673519a73
commit
b159577c23
13 changed files with 314 additions and 17 deletions
|
|
@ -279,6 +279,27 @@ func TestCheckIngress(t *testing.T) {
|
|||
}
|
||||
})
|
||||
|
||||
t.Run("When invalid directives are used in annotation values", func(t *testing.T) {
|
||||
nginx.store = fakeIngressStore{
|
||||
ingresses: []*ingress.Ingress{},
|
||||
configuration: ngx_config.Configuration{
|
||||
AnnotationValueWordBlocklist: "invalid_directive, another_directive",
|
||||
},
|
||||
}
|
||||
nginx.command = testNginxTestCommand{
|
||||
t: t,
|
||||
err: nil,
|
||||
}
|
||||
ing.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/custom-headers"] = "invalid_directive"
|
||||
if err := nginx.CheckIngress(ing); err == nil {
|
||||
t.Errorf("with an invalid value in annotation the ingress should be rejected")
|
||||
}
|
||||
ing.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/custom-headers"] = "another_directive"
|
||||
if err := nginx.CheckIngress(ing); err == nil {
|
||||
t.Errorf("with an invalid value in annotation the ingress should be rejected")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("When a new catch-all ingress is being created despite catch-alls being disabled ", func(t *testing.T) {
|
||||
backendBefore := ing.Spec.Backend
|
||||
disableCatchAllBefore := nginx.cfg.DisableCatchAll
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue