[go: up one dir, main page]

Menu

#22 NagiosQL remove <> from inserted strings

3.4.1
closed
nobody
None
2023-01-09
2020-08-26
Pozda
No

Hi

If I want to change host notes to following string
<latlng>50.123456, 15.123456</latlng>

Nagiosql remove leading <latlng> and tailing </latlng> and save notes as 50.123456, 15.123456.

Is it possible turn off inserted string checking?

Thanks
Pozda

Discussion

  • Martin

    Martin - 2020-08-28

    Hot as option but inside the code. As NagiosQL is a web based application, most data fields are secured by hardening functions to prevent SQL injections and cross-side-scripting.

    The host notes field is normaly not used to store "HTML like" code - therefore all tags will be removed while saving.

    What is the use case to insert tags in that field?

     
  • Pozda

    Pozda - 2020-10-13

    Unfortunatelly some other projects (https://github.com/jocafamaka/nagmapReborn) use this "dangerous" characters in nagios configuration files.

    In many installation I'm the only admin with access to nagiosql. So if there is an option in code, it is enough for me. Where can I found it?

     
  • Martin

    Martin - 2020-10-22

    That's a bit complicated - you have first check in HTML code the field name of the notes field. Probably its named "tfValue7". Then you can check the PHP file functions/prepend_content.php.

    There is a section for "Common text field value" that processes all these text fields. The filter_var for this fields is "FILTER_SANITIZE_STRING". You could change this to FILTER_UNSAFE_RAW like the "Argument" fields in next section and the database will store it unsecured with html tags. But this means, that all text fields in the whole application are unsafe from now!

    The better way is to use another type for this field. You can change "tfValue7" in HTML to "tfSpValue1" if this is not just used in this html template. But you have to change also the variable $chkTfValue7 in the corresponding php file (hosts.php) to $chkTfSpValue1. In this case only the single field in the single template accepts special chars from now.

    If "tfSpValue1" is just used, you can add an additional line in prepend_content.php for "tfSpValue2".

     
  • Martin

    Martin - 2023-01-09
    • status: open --> closed
     

Log in to post a comment.