mirror of
https://github.com/Cacti/cacti.git
synced 2026-10-26 13:08:09 +09:00
* fix(plugins): honor version range boundaries and compatibility status Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(plugins): preserve null hook diagnostics and enforce dependency versions Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(plugins): report config failures and confine error attribution Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(plugins): guard entrypoint frames and bind realm filenames Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(plugins): propagate install hook failures on develop Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(plugins): match realm filenames literally Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs(changelog): defer release entries to final backlog PR Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * test(plugins): add standard GPL headers Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * ci(coverage): require 80 percent of changed PHP statements Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * ci: share changed-code coverage contracts and enforce shell policy Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(ci): run request coverage with portable path matching Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * ci: retain bootstrap coverage and validate request dispatch Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * test: synchronize native coverage fixture dispatch Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * test: measure coverage at the exact PR revision Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
59 lines
3.0 KiB
PHP
59 lines
3.0 KiB
PHP
<?php
|
|
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2026 The Cacti Group |
|
|
| |
|
|
| This program is free software; you can redistribute it and/or |
|
|
| modify it under the terms of the GNU General Public License |
|
|
| as published by the Free Software Foundation; either version 2 |
|
|
| of the License, or (at your option) any later version. |
|
|
| |
|
|
| This program is distributed in the hope that it will be useful, |
|
|
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
| GNU General Public License for more details. |
|
|
+-------------------------------------------------------------------------+
|
|
| Cacti: The Complete RRDtool-based Graphing Solution |
|
|
+-------------------------------------------------------------------------+
|
|
*/
|
|
|
|
require_once dirname(__DIR__, 2) . '/Helpers/CactiStubs.php';
|
|
require_once dirname(__DIR__, 3) . '/include/global.php';
|
|
|
|
test('error attribution respects the Cacti plugin root and owning directory (#7968)', function () {
|
|
$name = 'error_fixture_' . bin2hex(random_bytes(6));
|
|
$directory = CACTI_PATH_PLUGINS . '/' . $name;
|
|
$outside = sys_get_temp_dir() . '/' . $name;
|
|
mkdir($directory . '/vendor/plugins/thold', 0700, true);
|
|
mkdir($outside . '/plugins/thold', 0700, true);
|
|
|
|
try {
|
|
file_put_contents($directory . '/setup.php', '<?php');
|
|
file_put_contents($directory . '/vendor/plugins/thold/Foo.php', '<?php');
|
|
file_put_contents($outside . '/plugins/thold/Foo.php', '<?php');
|
|
expect(cacti_error_plugin($directory . '/setup.php'))->toBe($name);
|
|
expect(cacti_error_plugin($directory . '/vendor/plugins/thold/Foo.php'))->toBe($name);
|
|
expect(cacti_error_plugin($outside . '/plugins/thold/Foo.php'))->toBe('');
|
|
expect(cacti_error_plugin(CACTI_PATH_PLUGINS . '/../lib/functions.php'))->toBe('');
|
|
expect(cacti_error_plugin($directory . '/missing.php'))->toBe('');
|
|
expect(cacti_error_plugin(CACTI_PATH_PLUGINS . '/index.php'))->toBe('');
|
|
|
|
// A file reached through a plugin symlink still lies outside the resolved
|
|
// plugin root and must not cause a same-named Cacti plugin to be disabled.
|
|
symlink($outside . '/plugins/thold', $directory . '/external');
|
|
expect(cacti_error_plugin($directory . '/external/Foo.php'))->toBe('');
|
|
unlink($directory . '/external');
|
|
} finally {
|
|
unlink($directory . '/setup.php');
|
|
unlink($directory . '/vendor/plugins/thold/Foo.php');
|
|
unlink($outside . '/plugins/thold/Foo.php');
|
|
rmdir($directory . '/vendor/plugins/thold');
|
|
rmdir($directory . '/vendor/plugins');
|
|
rmdir($directory . '/vendor');
|
|
rmdir($directory);
|
|
rmdir($outside . '/plugins/thold');
|
|
rmdir($outside . '/plugins');
|
|
rmdir($outside);
|
|
}
|
|
});
|