Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

HTML Entities cause REST API Serialization Errors #6110

Closed
richardlawley opened this issue Mar 6, 2018 · 2 comments
Closed

HTML Entities cause REST API Serialization Errors #6110

richardlawley opened this issue Mar 6, 2018 · 2 comments

Comments

@richardlawley
Copy link
Contributor


BUG REPORT INFORMATION

Centreon Web version: 2.8.18

Centreon Engine version: 1.8.1

Centreon Broker version: 3.0.13

OS: CentOS 7.4 (up-to-date)

Additional environment details (AWS, VirtualBox, physical, etc.): Virtualbox

Steps to reproduce the issue:

  1. Install clean Centreon installation
  2. Authenticate with REST api to obtain auth token
  3. POST { "action": "show", "object": "CMD" } to centreon/api/index.php?action=action&object=centreon_clapi

Describe the results you received:

{
    "result": [
        { 
            "id": "35",
            "name": "host-notify-by-email",
            "type": "notif",
            "line": [
                "/usr/bin/printf \"%b\" \"***** centreon Notification *****<br/><br/>Type:$NOTIFICATIONTYPE$<br/>Host: $HOSTNAME$<br/>State: $HOSTSTATE$<br/>Address: $HOSTADDRESS$<br/>Info: $HOSTOUTPUT$<br/>Date/Time: $DATE$\" ",
                " @MAILER@ -s \"Host $HOSTSTATE$ alert for $HOSTNAME$!\" $CONTACTEMAIL$"
            ]
        },   
        { ... },      // Subsequent commands omitted for brevity
        { ... },
        { ... },
        false,     // Corresponds to host-notify-by-jabber - error serializing?
        { ... }
    ]
}

Describe the results you expected:

All commands correctly serialized - no element replaced by false

Additional information you think important (e.g. issue happens only occasionally):

This is related to serializing the "line" for host-notify-jabber, which in the default installation is:

$USER1$/notify_via_jabber  $CONTACTPAGER$ "Host &#039;$HOSTALIAS$&#039; is $HOSTSTATE$ - Info: $HOSTOUTPUT$"

The cause of this specific case is the HTML entity &#039; - removing this allows the output to serialize correctly.

@lpinsivy
Copy link
Contributor

you right, same for "submit-service-check-result" command

@chgautier
Copy link
Contributor

Fix on PR#6234. Using the API Rest to generate the command, no element is replaced by false and therefore all commands are correctly serialized.

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

No branches or pull requests

3 participants