Files
cacti/tests/security/baselines/architectural_hotspots.baseline.tsv
T
Thomas Vincent 2b6e96b23a style(php): [develop] wrap CLI and poller calls without changing execution (#8303)
* style(php): wrap CLI and poller calls without changing execution

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(ci): review security inventories after poller wrapping

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(boost): compare handoff source contracts by PHP tokens

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* style(php): wrap poller constant strings without changing values

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* style(php): wrap poller concatenations with token-preserving source contracts

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(cli): assert CDEF repair queries after constant folding

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: verify PHP formatting preserves parsed behavior

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-14 00:01:26 -07:00

14 KiB

1classlocationmatch
2cmd_exec./cactid.phpexec('pgrep -a php | grep cactid.php', $output);
3cmd_exec./cli/audit_database.phpexec('php ' . CACTI_PATH_PLUGINS . '/' . $pname . '/database_upgrade.php --type=large --force-ver=' . $old,
4cmd_exec./cli/audit_database.php$db_shell = trim((string) shell_exec('which mysql'));
5cmd_exec./cli/audit_database.phpexec($cmd, $output, $error);
6cmd_exec./cli/audit_database.phpexec('php ' . CACTI_PATH_CLI . '/upgrade_database.php --debug', $output, $return_var);
7cmd_exec./cli/batchgapfix.phpexec($command, $output, $return_var);
8cmd_exec./cli/float_rrdfiles.php$response = exec($command, $output, $return);
9cmd_exec./cli/float_rrdfiles.php$response = exec($command, $output, $return);
10cmd_exec./cli/push_out_hosts.phppassthru($php_binary . ' ' . CACTI_PATH_CLI . '/rebuild_poller_cache.php ' . $parameters);
11cmd_exec./cli/remove_broken_graphs.php$stty = shell_exec('stty size');
12cmd_exec./cli/rrdresize.php$process = proc_open($path_rrdtool . ' -', $fds, $pipes);
13cmd_exec./cli/splice_rrd.php$result = exec($command, $output, $return_var);
14cmd_exec./cli/splice_rrd.php$response = shell_exec(cacti_escapeshellcmd($rrdtool));
15cmd_exec./cli/splice_rrd.phpshell_exec(cacti_escapeshellcmd($rrdtool) . ' dump ' . cacti_escapeshellarg($newrrd) . ' > ' . cacti_escapeshellarg($newxmlfile));
16cmd_exec./cli/splice_rrd.phpshell_exec(cacti_escapeshellcmd($rrdtool) . ' dump ' . cacti_escapeshellarg($oldrrd) . ' > ' . cacti_escapeshellarg($oldxmlfile));
17cmd_exec./cli/update_heartbeat.php$result = exec($command, $output, $return_code);
18cmd_exec./cmd.php$cactiphp = proc_open($command, $cactides, $pipes);
19cmd_exec./cmd_realtime.php$cactiphp = proc_open(read_config_option('path_php_binary') . ' -q ' . CACTI_PATH_BASE . '/script_server.php realtime ' . cacti_escapeshellarg($poller_id), $cactides, $pipes);
20cmd_exec./graph_realtime.phpshell_exec($php_binary . ' -q ' . $script_path . ' ' . $args);
21cmd_exec./host.phpshell_exec(cacti_escapeshellcmd((string) read_config_option('path_php_binary')) . ' -q ' . cacti_escapeshellarg(CACTI_PATH_CLI . '/poller_reindex_hosts.php') . ' --qid=all --id=' . $host_id);
22cmd_exec./lib/dsstats.php$process = proc_open($command, $fds, $pipes);
23cmd_exec./lib/functions.php$output = shell_exec($script_path);
24cmd_exec./lib/functions.php$output = shell_exec($script_path);
25cmd_exec./lib/functions.php$shell = shell_exec(cacti_escapeshellcmd(read_config_option('path_rrdtool')) . ' -v 2>&1');
26cmd_exec./lib/functions.php$shell = shell_exec(cacti_escapeshellcmd(read_config_option('path_rrdtool')) . ' -v');
27cmd_exec./lib/functions.phpshell_exec($killCmd);
28cmd_exec./lib/functions.php$cpu_cores = shell_exec('/bin/nproc');
29cmd_exec./lib/functions.php$cpu_cores = shell_exec('/usr/bin/nproc');
30cmd_exec./lib/functions.php$output = shell_exec('nproc');
31cmd_exec./lib/functions.phpexec('id -nu', $o, $r);
32cmd_exec./lib/functions.php$cpu_cores = shell_exec('sysctl -n hw.ncpu');
33cmd_exec./lib/functions.php$processExists = trim((string) shell_exec($checkProcessCmd));
34cmd_exec./lib/functions.phpexec($command_line, $out, $return_code);
35cmd_exec./lib/functions.phpreturn exec('whoami') ?: '';
36cmd_exec./lib/functions.php * On Windows, exec()/shell_exec()/popen() route through cmd.exe, which ignores
37cmd_exec./lib/installer.php$output = shell_exec(
38cmd_exec./lib/installer.php$output = shell_exec(cacti_escapeshellcmd(str_replace('\\', '/', $path)) . ' --version 2>&1');
39cmd_exec./lib/installer.php$process = proc_open(
40cmd_exec./lib/ping.php$result = shell_exec('ping -6 -W ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' -p ' . $pattern . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
41cmd_exec./lib/ping.php$result = shell_exec('ping -W ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' -p ' . $pattern . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true) . ' 2>&1');
42cmd_exec./lib/ping.php$result = shell_exec('ping -t ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
43cmd_exec./lib/ping.php$result = shell_exec('ping6 -t ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
44cmd_exec./lib/ping.php$result = shell_exec('chcp 437 && ping -w ' . $this->timeout . ' -n ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
45cmd_exec./lib/ping.php$result = shell_exec('ping ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
46cmd_exec./lib/ping.php$result = shell_exec('ping -i ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
47cmd_exec./lib/ping.php$result = shell_exec('ping -m ' . ceil($this->timeout / 1000) . ' -n ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
48cmd_exec./lib/ping.php$result = shell_exec('ping -t ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
49cmd_exec./lib/ping.php$result = shell_exec('ping -t ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
50cmd_exec./lib/ping.php$result = shell_exec('ping -w ' . ceil($this->timeout / 1000) . ' -c ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true));
51cmd_exec./lib/ping.php$result = shell_exec(cacti_escapeshellarg($fping) . ' -q -t ' . $this->timeout . ' -c 1 -r ' . $this->retries . ' ' . cacti_escapeshellarg_cmd($this->host['hostname'], true, true) . ' 2>&1');
52cmd_exec./lib/poller.php$output = system(cacti_escapeshellcmd($php_path) . ' -l ' . cacti_escapeshellarg($tmpfile), $exit);
53cmd_exec./lib/poller.php$fp = popen($command, 'r');
54cmd_exec./lib/poller.php$fp = popen($command, 'rb');
55cmd_exec./lib/poller.phpexec($safe_filename . ' ' . $args . ' ' . $redirect_args . ' &');
56cmd_exec./lib/poller.phpexec($safe_filename . ' ' . $args . ' > /dev/null 2>&1 &');
57cmd_exec./lib/poller.php$output = shell_exec($command);
58cmd_exec./lib/poller.php$setsid_path = trim((string) shell_exec('which setsid 2>/dev/null'));
59cmd_exec./lib/poller.php$process = @proc_open($command, $descriptors, $pipes, null, null, ['bypass_shell' => true]);
60cmd_exec./lib/poller.php$process = proc_open('exec ' . $cmd_full, $descriptors, $pipes);
61cmd_exec./lib/poller.php * of the proc_open() and proc_close() functions (php 4.3+)
62cmd_exec./lib/poller.php * @param array $pipes The array of r/w pipes returned from proc_open()
63cmd_exec./lib/poller.php * @param mixed $proc_fd The file descriptor returned from proc_open()
64cmd_exec./lib/rrd.php$process = proc_open([$path, '-'], $descriptors, $pipes, null, null, ['bypass_shell' => true]);
65cmd_exec./lib/rrdcheck.php$process = proc_open($command, $fds, $pipes);
66cmd_exec./lib/snmp.php// exec() does not capture, so the walk output can never contain either.
67cmd_exec./lib/snmp.phpexec($command, $snmp_value, $return_var);
68cmd_exec./lib/snmp.phpexec($command, $snmp_value, $return_var);
69cmd_exec./lib/snmp.phpexec($command, $snmp_value, $return_var);
70cmd_exec./lib/snmpagent.php// add pollers of a distributed system (future)
71cmd_exec./lib/spikekill.php$dump_output = shell_exec(cacti_escapeshellcmd(read_config_option('path_rrdtool')) . ' dump ' . cacti_escapeshellarg($this->rrdfile) . ' 2>&1 > ' . cacti_escapeshellarg($xmlfile));
72cmd_exec./lib/spikekill.php$response = shell_exec(cacti_escapeshellcmd(read_config_option('path_rrdtool')) . ' restore -f -r ' . cacti_escapeshellarg($xmlfile) . ' ' . cacti_escapeshellarg($rrdfile));
73cmd_exec./lib/utility.php$nproc = system('nproc');
74cmd_exec./lib/utility.phpexec('/usr/bin/free', $output, $exit_code);
75cmd_exec./lib/utility.phpexec('wmic os get FreePhysicalMemory', $memInfo['FreePhysicalMemory']);
76cmd_exec./lib/utility.phpexec('wmic os get FreeSpaceInPagingFiles', $memInfo['FreeSpaceInPagingFiles']);
77cmd_exec./lib/utility.phpexec('wmic os get FreeVirtualMemory', $memInfo['FreeVirtualMemory']);
78cmd_exec./lib/utility.phpexec('wmic os get SizeStoredInPagingFiles', $memInfo['SizeStoredInPagingFiles']);
79cmd_exec./lib/utility.phpexec('wmic os get TotalVirtualMemorySize', $memInfo['TotalVirtualMemorySize']);
80cmd_exec./lib/utility.phpexec('wmic os get TotalVisibleMemorySize', $memInfo['TotalVisibleMemorySize']);
81cmd_exec./lib/utility.php$json = shell_exec($php . ' -q ' . $php_file);
82cmd_exec./lib/utility.php$json = shell_exec($php . ' -q ' . $php_file);
83cmd_exec./lib/utility.php$json = shell_exec($php . ' -q ' . $php_file);
84cmd_exec./poller_spikekill.php$response = exec(cacti_escapeshellcmd((string) read_config_option('path_php_binary')) . ' -q ' .
85cmd_exec./remote_agent.php$cactiphp = proc_open(read_config_option('path_php_binary') . ' -q ' . CACTI_PATH_BASE . '/script_server.php realtime ' . cacti_escapeshellarg($poller_id), $cactides, $pipes);
86cmd_exec./scripts/sql.php$sql = shell_exec($cmd);
87cmd_exec./scripts/ss_netsnmp_lmsensors.php$virtual = intval(shell_exec('/usr/bin/hostnamectl 2> /dev/null | grep -i virtual | wc -l'));
88cmd_exec./scripts/ss_sql.php$result = shell_exec($cmd) ?? '';
89cmd_exec./snmpagent_mibcache.phpexec($php . ' ' . $extra_args . ' > /dev/null &');
90cmd_exec./snmpagent_persist.phpexec($php . ' ' . $extra_args . ' > /dev/null &');
91cmd_exec./support.php$out = shell_exec(cacti_escapeshellarg($path) . ' ' . $arg . ' 2>&1');
92cmd_exec./support.phpprint '<td>' . tech_env_status(DB_STATUS_WARNING, __('Version unavailable: shell_exec() is disabled')) . '</td>';
93cmd_exec./support.phpexec(cacti_escapeshellcmd(read_config_option('path_rrdtool')), $out_array);
94cmd_exec./support.php$cli_json = shell_exec(cacti_escapeshellcmd($php_binary) . ' -q ' . cacti_escapeshellarg(CACTI_PATH_INSTALL . '/cli_check.php') . ' extensions');
95cmd_exec./support.php$snmp_version = (string) shell_exec(cacti_escapeshellcmd($snmpget_path) . ' -V 2>&1');
96cmd_exec./support.phpexec(cacti_escapeshellcmd(read_config_option('path_spine')) . ' --version', $out_array);
97dynamic_include./cli/audit_database.phprequire_once($plugin . '/includes/database.php');
98dynamic_include./cli/audit_database.phprequire_once($plugin . '/setup.php');
99dynamic_include./cli/upgrade_database.phpinclude($upgrade_file);
100dynamic_include./include/global.phprequire_once($vendor_autoload);
101dynamic_include./include/global_languages.phprequire_once($providerFull);
102dynamic_include./index.phprequire_once($file);
103dynamic_include./lib/installer.phpinclude_once($upgrade_file);
104dynamic_include./lib/plugins.phpinclude_once($full_path);
105dynamic_include./lib/plugins.phprequire_once($setup_file);
106dynamic_include./lib/renderer.phpinclude $__cacti_template_file;
107dynamic_include./lib/rrd.phpinclude($rrdtheme);
108dynamic_include./lib/rrd.phpinclude($themefile);
109dynamic_include./link.phprequire_once($file);
110dynamic_include./plugins.phprequire_once($setup_file);
111dynamic_include./reports.phprequire_once($reportit_api);
112dynamic_include./script_server.phprequire_once($include_file);
113dynamic_include./scripts/ss_mikrotik_snmpget.phpinclude_once($config['base_path'] . '/lib/snmp.php');
114dynamic_include./scripts/ss_netsnmp_lmsensors.phpinclude($config['base_path'] . '/lib/snmp.php');
115dynamic_include./snmpagent_persist.phprequire($path_mibcache);
116host_header./lib/auth.php$result['link'] = \Sonata\GoogleAuthenticator\GoogleQrUrl::generate($current_user['username'] . '@' . $_SERVER['HTTP_HOST'], $current_user['tfa_secret'], 'Cacti');