Bug: LibreNMS shows Oxidized config ' instead of '

LibreNMS shows ' instead of ' in the config tab in LibreNMS web gui.
However, when looking at config via the oxidized web gui, the ' character is shown correctly.
I use Ubuntu 18.04 and Apache web server.

An example from LibreNMS web gui:

set firewall group port-group WEB-PORTS port '80'
set firewall group port-group WEB-PORTS port '443'
set firewall ip-src-route 'disable'
set firewall ipv6-receive-redirects 'disable'

A correct working example from Oxidized web GUI:

set firewall group port-group WEB-PORTS port '80'
set firewall group port-group WEB-PORTS port '443'
set firewall ip-src-route 'disable'
set firewall ipv6-receive-redirects 'disable'

And my info from validate.php

sliddjur@librenms:/opt/librenms$  sudo ./validate.php
[sudo] password for sliddjur: 
====================================
Component | Version
--------- | -------
LibreNMS  | 1.59
DB Schema | 2019_12_16_140000_create_customoids_table (152)
PHP       | 7.2.24-0ubuntu0.18.04.2
MySQL     | 10.1.43-MariaDB-0ubuntu0.18.04.1
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 1.9.2
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct

I have the same problem

We ran into this after enabling oxidized integration recently.

In our case it appears to be an issue between php’s default use of HTML4 and ignoring single quote escapes, and oxidized’s escaping of single quotes in version-specific config pulls with a code that isn’t part of the HTML4 standard.

I changed the following on line 304 of librenms/includes/html/pages/device/showconfig.inc.php:
$geshi = new GeSHi(htmlspecialchars_decode($text), $language);
to:
$geshi = new GeSHi(htmlspecialchars_decode($text, ENT_QUOTES | ENT_HTML5), $language);
and that fixed it. Whether that’s the ideal solution is debatable.

That I’ve seen, the problem isn’t present in diffs or unversioned/single-versioned configs, just full config pulls from a version-enabled oxidized against devices with multiple config versions.

So far I haven’t noticed any issues introduced by the change.

Centos 7
nginx

====================================
Component | Version
--------- | -------
LibreNMS  | 21.5.1-20-g70023c0
DB Schema | 2021_04_08_151101_add_foreign_keys_to_port_group_port_table (208)
PHP       | 7.3.27
Python    | 3.6.8
MySQL     | 10.5.9-MariaDB
RRDTool   | 1.4.8
SNMP      | NET-SNMP 5.7.2
====================================

[OK]    Composer Version: 2.0.14
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[OK]    Connection to memcached is ok`
[WARN]  Your local git contains modified files, this could prevent automatic updates.
        [FIX]:
        You can fix this with ./scripts/github-remove
        Modified Files:
         includes/html/pages/device/showconfig.inc.php