Alertmanager: reject global mattermost_webhook_url_file - #7768
Open
friedrichg wants to merge 2 commits into
Open
Alertmanager: reject global mattermost_webhook_url_file#7768friedrichg wants to merge 2 commits into
friedrichg wants to merge 2 commits into
Conversation
validateGlobalConfig checks ten global *_file settings but omitted MattermostWebhookURLFile, the only one missing. This was not exploitable. When a mattermost receiver is present, upstream copies the global value into the receiver's WebhookURLFile during unmarshal (config.go:637), which happens inside config.Load and therefore before validateAlertmanagerConfig runs, so validateMattermostConfig already rejected it. With no mattermost receiver the global value was accepted but never propagated, and nothing read it. The coverage was accidental though: it depends entirely on upstream doing that propagation in UnmarshalYAML. If that ever moves into the notifier constructor the check silently stops working. Validate the field directly so the guarantee does not rest on upstream ordering. Reuse the existing error and extend its message to name both settings, matching how slack_api_url_file, rocketchat_token_file and the other dual-scope settings are reported. Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
friedrichg
force-pushed
the
global-mattermost-file
branch
from
August 14, 2026 22:40
fef55d2 to
8bdafbd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does: Adds
mattermost_webhook_url_fileto the global*_filechecks invalidateGlobalConfig, the only one of the eleven that was missing.Not exploitable today. When a mattermost receiver is present, upstream copies the global value into the receiver's
WebhookURLFileduring unmarshal, which runs before validation, so the per-receiver check already rejected it. With no mattermost receiver the value was accepted but never read.The coverage was accidental though, resting entirely on upstream doing that propagation in
UnmarshalYAML. Validating the field directly means the guarantee no longer depends on upstream ordering.Reuses the existing error and extends its message to name both settings, matching how the other dual-scope settings are reported.
Found while auditing every file-path field reachable from a tenant config; the other 42 are all rejected.
CHANGELOG entry needs a PR number.