centreon / centreon

Centreon is a network, system and application monitoring tool. Centreon is the only AIOps Platform Providing Holistic Visibility to Complex IT Workflows from Cloud to Edge.
https://www.centreon.com
Apache License 2.0
87 stars 32 forks source link

Downtime comments have their single quotes escaped #4026

Open nfragnet opened 3 months ago

nfragnet commented 3 months ago

Hi,

    "'" => "\'", // '

Do single quotes really have to be escaped? (isn’t an un-escaped single-quote permitted in a double-quote quoted string?)

I’m not really sure about that but it seems this is what makes downtime comments now (in 23.10.11 compared with 22.10.19) to have their single quote escaped, thus making downtime deletions initiated via the APIv1 to not work anymore (ticket #73914) created for this issue.

_Originally posted by @StefThomas in https://github.com/centreon/centreon/pull/2822#discussion_r1590991604_

StefThomas commented 3 months ago

In fact single quotes are added by Centreon, but only via the API, not the UI, not even needed to be entered by the user:

$ sudo centreon -u cs.clapi -p "$(cat "/home/su.thomas-st/.cs.clapi.pass")" -o RTDOWNTIME -a add -v "HOST;AIXTEST3;$(date +"%Y/%m/%d %H:%M");$(date +"%Y/%m/%d %H:%M" -d "+24 hours");1;3600;test 202405 $$-${PPID};1" && echo $?  # Downtime sur host via CLAPI

0

image