Skip to content

Variable $SERVICEOUTPUT$ is not sanitized #1813

@TomaszUrugOlszewski

Description

@TomaszUrugOlszewski

Hello,

Shinken variable $SERVICEOUTPUT$ which is used as parameter for command notify-service-by-email is not sanitized, and signs like " (inverted comma) are passed without escaping.

Because of above behavior, default notification command notify-service-by-email can fail very easily.

For example using standard nagios plugin /usr/lib/nagios/plugins/check_http which returns string in "" when used with -e parameter

HTTP OK: Status line output matched "HTTP/1.1 200 OK" - 559 bytes in 0.090 second response time |time=0.089884s;;;0.000000 size=559B;;;0

And of course error message from logs (I removed beggining)

,,OK,,HTTP OK: Status line output matched "HTTP/1.1 200 OK" - 6496 bytes in 0.109 second response time,,00h 00m 00s"' raised an error (exit code=1): 'Traceback (most recent call last)

Error message is

Traceback (most recent call last):
  File "/var/lib/shinken/libexec/notify_by_email.py", line 323, in <module>
    'Service duration': macros[3]
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions