centreon-archived icon indicating copy to clipboard operation
centreon-archived copied to clipboard

fix(conf): Sanitize contact group names from illegal characters (#11480)

Open proxyconcept opened this issue 2 years ago • 1 comments

Description

Contact groups name can contains illegal characters when imported from LDAP (sanitize the input is complex due to synchronization process). Therefore illegal characters are removed only when generating nagios configuration files (and so according to the current poller configuration for illegal characters).

Fixes #11480

Type of change

  • [x] Patch fixing an issue (non-breaking change)
  • [ ] New functionality (non-breaking change)
  • [ ] Breaking change (patch or feature) that might cause side effects breaking part of the Software

Target serie

  • [ ] 21.04.x
  • [ ] 21.10.x
  • [x] 22.04.x
  • [ ] 22.10.x (master)

How this pull request can be tested ?

  1. Have a group in your LDAP server with a name containing a nagios illegal character (by default ~!$%^&*"|'<>?,()=)
  2. Configure the LDAP backend in Centreon (with group support) and synchronize (LDAP groups imported as contact groups)
  3. Edit a host and link for notifications the contact group from LDAP (with illegal chars)
  4. Generate the nagios configuration files for the poller

The generation should be OK and the nagios configuration files must contains the sanitized name for contact groups0

Checklist

Community contributors & Centreon team

  • [x] I have followed the coding style guidelines provided by Centreon
  • [x] I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • [x] I have commented my code, especially hard-to-understand areas of the PR.
  • [x] I have rebased my development branch on the base branch (master, maintenance).

proxyconcept avatar Aug 02 '22 10:08 proxyconcept

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@proxyconcept in order for the PR to be handled, you first have to create it for the develop branch. Make sure to synchronize it with the latest changes. Once created, make sure to add the label "22.04.x" for us to know it has to be backported, once reviewed and merged.

bdauria avatar Aug 23 '22 08:08 bdauria