mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Hide community and make it XSS safer (#13783)
* sanitize message display * sanitize message display * safe display of community, and community hidden until focus occurs
This commit is contained in:
@@ -55,7 +55,7 @@ if (! empty($_POST['hostname'])) {
|
||||
}
|
||||
|
||||
$snmpver = strip_tags($_POST['snmpver']);
|
||||
print_message("Adding host $hostname communit" . (count(Config::get('snmp.community')) == 1 ? 'y' : 'ies') . ' ' . implode(', ', Config::get('snmp.community')) . " port $port using $transport");
|
||||
print_message("Adding host $hostname communit" . (count(Config::get('snmp.community')) == 1 ? 'y' : 'ies') . ' ' . implode(', ', array_map("\LibreNMS\Util\Clean::html", Config::get('snmp.community'))) . " port $port using $transport");
|
||||
} elseif ($_POST['snmpver'] === 'v3') {
|
||||
$v3 = [
|
||||
'authlevel' => strip_tags($_POST['authlevel']),
|
||||
|
||||
@@ -33,7 +33,7 @@ if ($_POST['editing']) {
|
||||
$update['retries'] = ['NULL'];
|
||||
}
|
||||
|
||||
if ($snmpver != 'v3') {
|
||||
if ($snmpver != 'v3' && $_POST['community'] != '********') {
|
||||
$community = $_POST['community'];
|
||||
$update['community'] = $community;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ echo " </select>
|
||||
<div class='form-group'>
|
||||
<label for='community' class='col-sm-2 control-label'>SNMP Community</label>
|
||||
<div class='col-sm-4'>
|
||||
<input id='community' class='form-control' name='community' value='" . htmlspecialchars($device['community']) . "'/>
|
||||
<input id='community' class='form-control' name='community' value='********' onfocus='this.value=(this.value==\"********\" ? decodeURIComponent(\"" . rawurlencode($device['community']) . "\") : this.value);'/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user