Skip to content

fix: require authorization for Webex receivers - #8899

Closed
spicysharkco wants to merge 1 commit into
prometheus-operator:mainfrom
spicysharkco:fix/webex-authorization
Closed

spicysharkco wants to merge 1 commit into
prometheus-operator:mainfrom
spicysharkco:fix/webex-authorization

Conversation

@spicysharkco

Copy link
Copy Markdown
Contributor

Description

Closes #8889.

A selected AlertmanagerConfig with webexConfigs: [{roomID: room-1}] and no httpConfig passes validation, but Alertmanager refuses the configuration. A token reference to an existing Secret key with an empty value has the same effect, including with #8897.

pkg/assets/store.go:350 accepts an empty value. Rendering drops empty authorization credentials (pkg/alertmanager/amcfg.go:1890) and omits an empty bearer token (pkg/alertmanager/types.go:240). Alertmanager v0.34.1 rejects the receiver at config/notifiers.go:152, before global HTTP fallback at config/config.go:578.

Require authorization or bearerTokenSecret in both API versions. Reject empty referenced credentials with the existing validation.NotEmpty check at pkg/alertmanager/operator.go:1639. The shared check covers selected resources and spec.alertmanagerConfiguration.

Builds on #8897 by @A-RYAN-1, which supplies the field-presence validation and tests, including bearer-token compatibility. This adds the two empty-secret regressions and their fix. Overlap checked: #8897 is the only Webex overlap. release-0.94 also has the missing check.

Type of change

  • BUGFIX (non-breaking change which fixes an issue)

Verification

Run locally:

  • go test -p 4 -count=1 -json ./pkg/alertmanager ./pkg/alertmanager/validation/v1beta1 -run 'TestCheckWebexAlertmanagerConfig|TestValidateWebexConfigsRequireAuthorization': main has 6 failing and 4 passing subtests; fix: require httpConfig.authorization for Webex receivers #8897 has 2 failing and 8 passing; this fix passes all 10.
  • go test -p 4 -count=1 -json ./pkg/alertmanager/...: 102 tests and 606 subtests pass across 4 packages; 2 packages have no tests.
  • make generate-crds bundle.yaml Documentation/api-reference/api.md: no additional diff. make check: passes with zero issues.
  • go test -p 4 -count=1 -json ./pkg/admission: 11 tests and 14 subtests pass; TestAdmitBadRuleWithBooleanInAnnotations fails. That failure also reproduces on main with go test -p 4 -count=1 -json ./pkg/admission -run '^TestAdmitBadRuleWithBooleanInAnnotations$'.

Not tested: live configuration reload or Webex delivery.

Changelog entry

Reject AlertmanagerConfig Webex receivers with missing authorization or empty credentials, while accepting bearerTokenSecret.

Build on prometheus-operator#8897 and accept authorization or bearerTokenSecret in both
AlertmanagerConfig versions. Reject references to empty credentials before
configuration assembly, using the existing secret validator.

Keep the alpha regression cases with the operator tests.

Closes prometheus-operator#8889

Co-authored-by: Aryan Deshmukh <[email protected]>
Signed-off-by: spicysharkco <[email protected]>
@simonpasquier

Copy link
Copy Markdown
Contributor

duplicates #8897 which was submitted before

@heliapb

heliapb commented Oct 20, 2026

Copy link
Copy Markdown
Member

closing as #8897 was merged already

@heliapb heliapb closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AlertmanagerConfig accepts webexConfigs without httpConfig.authorization, which Alertmanager rejects

3 participants