diff --git a/CHANGELOG.md b/CHANGELOG.md index efecf16..04b329c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ --- develop --- +* security: Replace the confirmation pages' inline `onClick='cactiReturnTo()'` Cancel buttons with the CSP-safe `cactiReturnTo` class and move the filter rows selects' inline `onChange` handlers into the ready block (bound via change, not click) so the pages no longer trip Cacti's Content-Security-Policy script-src-attr directive * dev: Keep the status-legend chips equal width (sized to the longest label, laid out as a CSS grid so chips stay equal across wrapped rows) as the legend wraps responsively * dev: Measure CI coverage with xdebug instead of pcov so the plugin's own sources are instrumented (pcov auto-scopes to the Composer root and skipped cacti/plugins/, leaving the patch-coverage gate with nothing to measure) * dev: Enforce patch coverage of changed lines in CI and remove the inert COMPOSER_ROOT_VERSION env from the Pest step diff --git a/README.md b/README.md index 588aa40..b7ba317 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,20 @@ is going to be down can be configured so that escallation does not needlessly take place during maintenance periods. +## Cacti compatibility + +If you are running a version of Cacti below 1.2.31, please add the function +below to the `applySkin()` function in `include/layout.js` to enable the Cancel +buttons on forms to work: + +```js +$(document).off('click.cactiReturnTo', '.cactiReturnTo') + .on('click.cactiReturnTo', '.cactiReturnTo', function(event) { + event.preventDefault(); + cactiReturnTo($(this).attr('data-url')); + }); +``` + ## Upgrading `poller_servcheck.php` runs as a long-lived background process, so a running diff --git a/servcheck_ca.php b/servcheck_ca.php index 4319757..3df4bcb 100644 --- a/servcheck_ca.php +++ b/servcheck_ca.php @@ -133,7 +133,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } } else { raise_message(40); @@ -423,7 +423,7 @@ function servcheck_filter(): void { - ' . __('Default', 'servcheck') . ''; @@ -463,7 +463,7 @@ function clearFilter() { } $(function() { - $('#rows').click(function() { + $('#rows').change(function() { applyFilter(); }); diff --git a/servcheck_credential.php b/servcheck_credential.php index 2118d5c..0eca37b 100644 --- a/servcheck_credential.php +++ b/servcheck_credential.php @@ -155,7 +155,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } elseif (get_filter_request_var('drp_action') == 2) { // duplicate print " @@ -163,7 +163,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } } else { raise_message(40); @@ -944,7 +944,7 @@ function servcheck_filter(): void { - ' . __('Default', 'servcheck') . ''; @@ -984,6 +984,10 @@ function clearFilter() { } $(function() { + $('#rows').change(function() { + applyFilter(); + }); + $('#refresh').click(function() { applyFilter(); }); diff --git a/servcheck_proxy.php b/servcheck_proxy.php index f4343a8..286d935 100644 --- a/servcheck_proxy.php +++ b/servcheck_proxy.php @@ -132,7 +132,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } } else { raise_message(40); @@ -436,7 +436,7 @@ function servcheck_filter(): void { - ' . __('Default', 'servcheck') . ''; @@ -476,7 +476,7 @@ function clearFilter() { } $(function() { - $('#rows').click(function() { + $('#rows').change(function() { applyFilter(); }); diff --git a/servcheck_restapi.php b/servcheck_restapi.php index 0bf77a2..7ecd940 100644 --- a/servcheck_restapi.php +++ b/servcheck_restapi.php @@ -168,7 +168,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } elseif ($action == 'duplicate') { print " @@ -177,7 +177,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } } else { raise_message(40); diff --git a/servcheck_test.php b/servcheck_test.php index acb67bd..ccf51a5 100644 --- a/servcheck_test.php +++ b/servcheck_test.php @@ -230,7 +230,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } elseif (get_filter_request_var('drp_action') == 2) { // disable print " @@ -239,7 +239,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } elseif (get_filter_request_var('drp_action') == 3) { // enable print " @@ -248,7 +248,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } elseif (get_filter_request_var('drp_action') == 4) { // duplicate print " @@ -257,7 +257,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } elseif (get_filter_request_var('drp_action') == 5) { // clear statistics print " @@ -266,7 +266,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } elseif (get_filter_request_var('drp_action') == 6) { // clear log print " @@ -275,7 +275,7 @@ function form_actions(): void { "; - $save_html = " "; + $save_html = " "; } } else { raise_message(40); diff --git a/tests/bin/patch-coverage.php b/tests/bin/patch-coverage.php index 9843b2f..f9b08b2 100644 --- a/tests/bin/patch-coverage.php +++ b/tests/bin/patch-coverage.php @@ -160,9 +160,11 @@ function changed_lines($base_ref) { * Empty by default; add entries per repository as the need arises. */ $unmeasured_allowlist = [ - // Web page controller: chdir()s and includes auth.php at the top level, so it - // cannot be loaded into the isolated unit process and is absent from Clover. - 'servcheck_test.php', + 'servcheck_ca.php', // web UI entry point (require auth.php); not loadable in the isolated unit process + 'servcheck_credential.php', // web UI entry point (require auth.php); not loadable in the isolated unit process + 'servcheck_proxy.php', // web UI entry point (require auth.php); not loadable in the isolated unit process + 'servcheck_restapi.php', // web UI entry point (require auth.php); not loadable in the isolated unit process + 'servcheck_test.php', // web UI entry point (require auth.php); not loadable in the isolated unit process ]; $unmeasured = array_values(array_diff(array_keys($changed), array_keys($measured))); $unexpected_unmeasured = array_values(array_diff($unmeasured, $unmeasured_allowlist));