GHSA-gxjc-74v5-3vx3: Input Validation

Published Sep 18, 2026
·
Updated

Summary A validation bug in internal/webhook/tenant/validation/forbiddenannotationsregex.go allows an invalid ForbiddenAnnotations.Regex value to bypass Tenant admission on update. The webhook compiles ForbiddenLabels.Regex for both labels and annotations, so a malformed annotations regex can be persisted. Once stored, namespace admission later evaluates the bad regex through pkg/api/forbiddenlist.go, where regexp.MustCompile can panic and cause admission failure.

Details In internal/webhook/tenant/validation/forbiddenannotationsregex.go, OnUpdate validates the new Tenant object, but the loop compiles tnt.Spec.NamespaceOptions.ForbiddenLabels.Regex for both labels and annotations. That means an invalid ForbiddenAnnotations.Regex is never validated if ForbiddenLabels.Regex is valid.

Relevant paths: - internal/webhook/tenant/validation/forbiddenannotationsregex.go - internal/webhook/namespace/validation/usermetadata.go - pkg/api/forbiddenlist.go

Namespace admission later calls api.ValidateForbidden(...), and ForbiddenListSpec.RegexMatch() uses regexp.MustCompile(in.Regex). If the malformed regex is present in the Tenant spec, any namespace request that reaches this check can panic or fail hard, causing denial of service for namespace operations in the affected tenant.

PoC 1. Update a Tenant so that: - spec.namespaceOptions.forbiddenLabels.regex is valid - spec.namespaceOptions.forbiddenAnnotations.regex is malformed, for example: [invalid-regex( 2. The Tenant update is accepted because the webhook compiles the labels regex for both fields. 3. Create or update a Namespace that triggers forbidden metadata validation. 4. The namespace admission path reaches regexp.MustCompile(...) and panics.

package main

import ( "fmt" "regexp" )

type ForbiddenListSpec struct { Regex string }

type NamespaceOptions struct { ForbiddenLabels ForbiddenListSpec ForbiddenAnnotations ForbiddenListSpec }

type Tenant struct { NamespaceOptions NamespaceOptions }

func validateTenantUpdate(tnt Tenant) error { if tnt.NamespaceOptions == nil { return nil }

annotationsToCheck := map[string]string{ "labels": tnt.NamespaceOptions.ForbiddenLabels.Regex, "annotations": tnt.NamespaceOptions.ForbiddenAnnotations.Regex, }

for scope, annotation := range annotationsToCheck { if , err := regexp.Compile(tnt.NamespaceOptions.ForbiddenLabels.Regex); err != nil { return fmt.Errorf("deny update: unable to compile %s regex for forbidden %s", annotation, scope) } }

return nil }

func validateForbidden(metadata map[string]string, forbidden ForbiddenListSpec) error { for key := range metadata { if forbidden.Regex != "" { if regexp.MustCompile(forbidden.Regex).MatchString(key) { return fmt.Errorf("forbidden key matched: %s", key) } } }

return nil }

func main() { oldTenant := &Tenant{ NamespaceOptions: &NamespaceOptions{ ForbiddenLabels: ForbiddenListSpec{Regex: ^[a-z0-9-]+$}, ForbiddenAnnotations: ForbiddenListSpec{Regex: ^[a-z0-9-]+$}, }, }

newTenant := &Tenant{ NamespaceOptions: &NamespaceOptions{ ForbiddenLabels: ForbiddenListSpec{Regex: ^[a-z0-9-]+$}, ForbiddenAnnotations: ForbiddenListSpec{Regex: [invalid-regex(}, }, }

fmt.Println("=== Update step ===") if err := validateTenantUpdate(newTenant); err != nil { fmt.Printf("unexpected deny: %v\n", err) } else { fmt.Println("allowed: malformed ForbiddenAnnotations.Regex bypassed validation") }

fmt.Println() fmt.Println("=== Namespace step ===") = oldTenant

defer func() { if r := recover(); r != nil { fmt.Printf("panic reproduced from ValidateForbidden: %v\n", r) } }()

= validateForbidden(map[string]string{"example": "value"}, ForbiddenListSpec{Regex: [invalid-regex(}) fmt.Println("no panic, unexpected") } Expected output:

text === Update step === allowed: malformed ForbiddenAnnotations.Regex bypassed validation

=== Namespace step === panic reproduced from ValidateForbidden: regexp: Compile([invalid-regex(): error parsing regexp: missing closing ]: [invalid-regex(

Impact An attacker who can update the Tenant configuration can persist a malformed ForbiddenAnnotations.Regex and cause namespace admission failures for the affected tenant. This can result in a tenant-scoped denial of service.

Affected Software

1 affected componentFixes available
go/github.com/projectcapsule/capsule>=0.13.0<0.13.7
0.13.7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/projectcapsule/capsule to a version that resolves this vulnerability.

    Fixed in 0.13.7

Event History

Sep 18, 2026
Advisory Published
via GitHub·05:14 PM
Data Sourced
via GitHub·05:14 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who can trigger the admission failure?

Exploitation requires high privileges, as reflected by the PR:H attack vector. An attacker needs the ability to update a Tenant object with a malformed ForbiddenAnnotations.Regex value while the corresponding ForbiddenLabels.Regex remains valid.

2

Which workloads or operations are affected after a malformed value is stored?

Namespace admission is affected when it evaluates the stored malformed annotations regex. The use of regexp.MustCompile can panic, causing namespace admission to fail.

3

How can administrators identify whether they are already exposed to this condition?

Review persisted Tenant specifications for NamespaceOptions.ForbiddenAnnotations.Regex values that are malformed regular expressions. A malformed value may have been accepted because update validation compiled ForbiddenLabels.Regex instead of the annotations regex.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203