Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added validation for incoming message (prevents panic) #210

Merged
merged 2 commits into from Jul 1, 2021
Merged

added validation for incoming message (prevents panic) #210

merged 2 commits into from Jul 1, 2021

Conversation

kbudde
Copy link
Collaborator

@kbudde kbudde commented May 21, 2021

Hi,

the problem with of the panic is caused by the embedded pointer to *template.Data in webhook.Message (alertmanager)
https://github.com/prometheus/alertmanager/blob/v0.20.0/notify/webhook/webhook.go#L69

if template.Data is nil, all access to fields of template.Data will cause a panic. For example here:

Receiver: promAlert.Receiver,

Somewhere the application revers from panic. So maybe you want to keep it like it is?

fixes #209

@codecov-commenter
Copy link

Codecov Report

Merging #210 (37f7600) into master (2c78204) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #210   +/-   ##
=======================================
  Coverage   15.80%   15.80%           
=======================================
  Files           5        5           
  Lines         424      424           
=======================================
  Hits           67       67           
  Misses        348      348           
  Partials        9        9           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c78204...37f7600. Read the comment docs.

Copy link
Collaborator

@Knappek Knappek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kbudde for this PR. Just one minor comment.

pkg/transport/transport.go Show resolved Hide resolved
@Knappek Knappek merged commit d7ce707 into prometheus-msteams:master Jul 1, 2021
@Knappek
Copy link
Collaborator

Knappek commented Jul 1, 2021

Thanks again @kbudde !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] panic on invalid alert / valid json
3 participants