* ci: allow the remediation publisher's credentialed checkout
released-dependency-audit.yml's publish-remediation job checks out 1.2.x
with persist-credentials: true because released_dependency_remediation.py
publishes with `git push origin`. The workflow policy treats every checkout
outside CHECKOUT_WRITE_WORKFLOWS as read-only, so "Workflow policy checks"
fails on develop and on every pull request. List the workflow with the
other workflows that push. Its read-only checkouts already set
persist-credentials: false.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(ci): cover the workflow policy's credentialed checkout list
Loads check-workflow-policy.py and checks that the remediation publisher's checkout is accepted while it is listed and reported once it is not, so the changed-Python coverage gate has evidence for the script.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* security(script-server): add path containment and preserve Windows script paths
Develop's script server loaded the include file after only a file_exists()
check and dispatched the named function with no containment, and
get_script_query_path() returned the raw script path. This forward-ports the
script-server hardening from 1.2.x and adapts it to the revised,
non-mangling path method so it works on Windows.
script_server.php:
- Build the allowed script roots from CACTI_PATH_BASE and CACTI_PATH_SCRIPTS.
- Validate realpath($include_file) is within the allowed roots before
require_once().
- After loading, reject PHP internal functions and any function whose
resolved source file lives outside the allowed roots (ReflectionFunction).
- Add the script_server_path_is_allowed() containment helper.
lib/data_query.php (get_script_query_path):
- Reject '..' path traversal.
- Sanitize the script path without corrupting Windows separators: strip
shell metacharacters on Windows while preserving the backslash separator
(cacti_escapeshellcmd() would turn 'C:\path\script.php' into
'C: path script.php', which the containment check then rejects as 'C:');
non-Windows platforms use escapeshellcmd() on their forward-slash paths.
Adds tests/Unit/Security/PathTraversal/ScriptServerContainmentHardeningTest.php
covering the containment guard and the Windows-safe sanitization, with both
source-scan and runtime suites.
Companion fixes: #8652 (1.2.x) and #8653 (1.2.31).
Forum: https://forums.cacti.net/viewtopic.php?t=64910
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(script-server): narrow realpath() result to satisfy PHPStan level 6
realpath() returns string|false; assigning it to \ propagated
string|false across the command loop, so basename(), realpath(),
file_exists(), cacti_strtolower() and script_server_log_request() were all
flagged as receiving string|false. Reject a false realpath() explicitly in
the containment guard (behaviour-preserving: script_server_path_is_allowed()
already returns false for a false path), which narrows \ to
string before it is assigned back to \.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(ui): use the three-bar action menu on the Details and Time View graph pages
The graph drilldown icons were switched to a hidden three-bar (hamburger)
action menu for the thumbnail/preview/tree graph areas, but the Details
(zoom) and Time View (utility) pages still rendered the raw glyph anchors.
Give those two areas the same graphDrillDownToggle treatment so the action
glyphs stay hidden behind the hamburger until it is activated, render the
drilldown container id through get_filter_request_var('local_graph_id'), and
move the Details graph title outside the toggle's positioning container
(matching html_graph_area() in lib/html.php) so a wide title no longer pushes
the hamburger off the graph corner.
Use the native Element.matches(':hover') in graphDrilldownStillHovered()
instead of jQuery's :hover: jQuery delegates :hover to Sizzle for a node
outside the document and throws "unsupported pseudo: hover" when a pending
close timer runs after the Details/Time View area reloads. A detached node
is treated as not hovered, so the native check cannot throw.
Add a coverage fixture that renders html_graph_single_view() and
html_graph_zoom() with their I/O stubbed and asserts the menu structure and
title placement, so the changed PHP output - not just handwritten browser
HTML - is exercised by the changed-line and request coverage gates.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs(changelog): add issue#8641 entry
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* security(html_graph): html-escape local_graph_id in drilldown container id
SonarCloud/Semgrep flag the raw get_filter_request_var(local_graph_id)
echoed into the drilldown container id attribute in html_graph_single_view()
and html_graph_zoom() as reflected XSS. The value is already int-validated,
but wrap it in htmle() so the request-to-response taint path is closed and
the scanners are satisfied.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix Cacti theme titlebar wrapping and link contrast
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* Add accessible headers to the theme fixture tables
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(cli): add --security-level and SNMPv3 help to change_device.php
change_device.php merges overrides onto the stored device, so a device
that was authPriv stayed authPriv when only auth settings were given.
Add --security-level to set noAuthNoPriv, authNoPriv or authPriv
explicitly, clearing protocols and secrets the level does not use.
Only require an SNMPv3 password when an auth protocol is set, validate
protocol names with the list of valid values, report the SNMPv3 user
and level instead of the community, and add SNMPv3 help examples.
* fix(cli): collapse SNMPv3 help prints to clear SonarQube duplication
The new SNMPv3 "security level" explanation and "Examples" sections in
change_device.php's display_help() were written as a run of ~20 consecutive
`print '...' . PHP_EOL;` statements. SonarCloud's token-based duplication
detector normalizes string literals, so this run matched the equally long
run of help prints in cli/structure_rra_paths.php, tripping the Quality
Gate (11.7% duplicated lines on new code, 1 block / 19 lines).
Collapse those two sections into a single concatenated `print` each. The
emitted help text is byte-for-byte identical; only the statement grouping
changes, which breaks the duplicated token run.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(cli): declare SNMPv3 protocol globals in change_device.php
The SNMPv3 validation block references the $snmp_auth_protocols and
$snmp_priv_protocols arrays (defined in include/global_arrays.php) without a
`global` declaration, so PHPStan (level 8, the Commit Audit "PHP 8.3 locked
integration" job) reports "Variable $snmp_auth_protocols might not be defined"
and the same for $snmp_priv_protocols.
Declare both arrays global at the top of the SNMPv3 branch, matching how every
other consumer of these arrays (managers.php, automation_snmp.php, lib/snmp.php)
brings them into scope. No behavioural change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Building the per-request INC and RESPONSE debug log strings (basename(),
implode() and string concatenation) on every poll is wasteful when debug
logging is disabled, which is the normal production configuration.
Introduce testable helpers in lib/functions.php:
- cacti_effective_log_level() resolves the effective verbosity the same way
cacti_log() does (selective per-file/per-plugin override, else log_verbosity).
- script_server_log_request() / script_server_log_response() only assemble and
emit their debug strings when that level is POLLER_VERBOSITY_DEBUG.
script_server.php now calls these helpers instead of building the strings
inline, so the hot path stays cheap while selective script-server debugging
keeps working. Unit coverage is added for the new helpers.
This is the develop counterpart of the 1.2.x change in #8585.
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci(deps): unblock minor and patch Dependabot updates on develop and 1.2.x
Scope the 7-day Dependabot cooldown to major releases (semver-major-days: 7) so weekly runs pick up minor and patch updates without an extra week of delay. Ignore unresolvable major versions on develop (symfony/* >= 8.0.0 on PHP 8.3 and pestphp/* >= 4.0.0) and all major version bumps on 1.2.x so Dependabot's Composer and npm version resolvers fall back to the latest minor and patch releases instead of aborting. Set versioning-strategy: increase for /api where no composer.lock is tracked.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(deps): enforce Dependabot branch policy
Cover every 1.2.x update entry and add the missing GitHub Actions major-version block. Run the contract test when dependency automation changes so the maintenance-branch blind spot cannot recur.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(deps): lock Composer and Symfony policy
Keep Composer update jobs on 1.2.x while requiring the only Symfony version cap to remain on develop at Symfony 7.x.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* ci(deps): draft 1.2.x security remediations
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The theme main.js files appended a search icon after any #filter/#filterd/#rfilter
input whenever it existed in the DOM, even while it was hidden, leaving a stray
icon on the page. Gate the decoration on the input being :visible, and defer it
with setTimeout(0) so it runs after applySkin()/cactiReady() reveal #main and
#navigation_right. The :visible check then skips only intentionally hidden filters,
while ordinary filters -- including after AJAX refreshes -- still receive their
icon, placeholder and autocomplete settings.
Also make cacti_trusted_proxy_match() IP-family aware so an IPv4-mapped IPv6
address (::ffff:a.b.c.d) never matches a bare IPv4 proxy entry. Newer Symfony
IpUtils releases normalize the mapped form inside checkIp(), which broke the
native dependency test matrix; gating on IP family keeps the match deterministic.
A coverage case keeps lib/client_address.php at 100%.
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* security(batch12): constant-time 2FA cookie and reset-token compares (GHSA-4qx8-jj2h-p7q2)
auth_2fa.php used === to compare the 2FA bypass-cookie HMAC and
auth_resetpassword.php used != for the reset-token check; both are
byte-by-byte and leak timing. Switch to hash_equals() so the comparison
is constant-time. Develop-only paths (no released 1.2.x equivalent).
* security(batch12): route package-repo manifest fetches through cacti_http (GHSA-54fg-q9h9-88mm)
package_repos.php fetched the package.manifest for the GitHub and
Direct-URL (repo_type 0/2) repository types with raw file_get_contents()
- the Direct-URL path additionally disabled SSL verification - which
bypassed the hardened cacti_http() client and allowed SSRF (cloud
metadata, internal host/port probing) plus MITM. Both paths now use
cacti_http(), which restricts the scheme to http/https, blocks
private/loopback/link-local targets, pins DNS to prevent rebinding, and
verifies TLS. The GitHub Bearer token is passed via the headers option.
Develop-only (package_repos.php does not exist in released 1.2.x).
* security(batch12): shed matched quotes around resolved data-input tokens (GHSA-5v3j-wcrr-jxjg)
Field values are escaped with cacti_escapeshellarg(), which wraps them
in single quotes. When a Data Input template author placed the <field>
placeholder inside a matched pair of quotes (e.g. "<arg1>"), those
surrounding quotes made the value's own quoting literal, so $(...) or
backticks in the value executed via the shell on the next poll - a
realm-3 user reaching OS command execution, bypassing the CVE-2026-39902
hardening and not addressed by the single-pass fq9x fix.
substitute_script_path() now consumes one matched pair of surrounding
quotes when a token resolves, so the escaped value's own quoting is
authoritative. Unresolved tokens keep their literal form (including any
quotes), and the single-pass behaviour that fixed GHSA-fq9x is retained.
Affects released 1.2.x (<= 1.2.31) and develop; this is the develop fix,
to be backported to 1.2.x.
* security(batch12): regression tests + CHANGELOG for batch-12 develop fixes
Add tests/Unit/Security/Batch12SecurityRegressionTest.php guarding the
batch-12 sinks (GHSA-4qx8, GHSA-54fg, GHSA-5v3j) with a behavioral proof
that a double-quoted Data Input placeholder sheds its quotes, plus a
confirmation test that poller_spikekill.php escapes --rrdfile
(GHSA-vhh2, already fixed in #7235). List the four GHSAs in the CHANGELOG.
* security(batch12): update batch-11 fq9x regression test for quote-aware substitute_script_path
The GHSA-5v3j quote-shedding changed substitute_script_path()'s regex
and capture group, which the batch-11 fq9x test pinned verbatim. Update
those two assertions to the quote-aware pattern marker and $matches[2];
the single-pass guarantee the test covers is unchanged.
* security(batch12): narrow reset-hash row with is_array for PHPStan L6
The hash_equals() guard left $hash inferred as non-empty-array|true, so
$hash['user_id'] tripped PHPStan level 6. Guard with is_array() instead
of a truthy check; db_fetch_row_prepared returns false for no row, so
behavior is unchanged.
* security(batch12): drop the executable bit on the new security test files
* security(batch12): route import-time repo manifest fetches through cacti_http (GHSA-54fg)
get_repo_file() still used raw file_get_contents() for the GitHub and Direct-URL repo types, bypassing the SSRF hardening added to form_save(). Route both remote branches through cacti_http() (scheme/host validation, private-range block, DNS pinning, TLS verify; Bearer token via the headers option) and add a regression assertion covering the import sink.
* security(batch12): make substitute_script_path fully quote-aware (GHSA-5v3j)
The matched-pair quote shed only neutralised a token the template wrapped
exactly ("<arg1>"). A token embedded in a larger quoted word ("prefix<arg1>",
"<arg1>suffix", "<a><b>") kept the outer double quotes, so backticks/$(...) in
the already-escaped value stayed live - the bypass Copilot flagged.
Replace the regex with a single-pass shell-quote-state scanner: it still sheds
an exact wrapping pair, but for any token inside a larger quoted word it briefly
closes the template's quoting around the escaped value so it cannot be
re-interpreted. Values are never re-scanned (single-pass, GHSA-fq9x retained).
Updates the batch-11/12 source assertions, adds prefix/suffix/mixed regression
cases, and drops the Batch12 eval fallback (the unit bootstrap already loads
lib/functions.php via include/global.php).
* security(batch12): relocate batch-12 regressions into vuln-class subfolders
Split tests/Unit/Security/Batch12SecurityRegressionTest.php into behavior-named
files under the existing vulnerability-class layout, per the review feedback:
Auth/TwoFaCookieAndResetTokenConstantTimeTest.php GHSA-4qx8
Ssrf/PackageRepoManifestFetchTest.php GHSA-54fg
ShellInjection/DataInputQuotedPlaceholderTest.php GHSA-5v3j
ShellInjection/SpikekillRrdfileEscapeTest.php GHSA-vhh2
Each file reaches the repo root via dirname(__DIR__, 4) for its one
subfolder-deep location. No assertion changes; pure relocation.
* security: preserve template quoting for raw path tokens in substitute_script_path
Keep the develop fix in sync with the 1.2.x backport (#8238): substitute_script_path()
only sheds/closes the template's quotes for self-quoting (cacti_escapeshellarg) values.
Trusted raw path_* tokens are substituted in place so a quoted "<path_php_binary>" keeps
its quotes for the shell and a bare <path_cacti>/scripts/x.php stays unquoted for the PHP
script server, which resolves the first token as a filesystem path. Reformatted per
php-cs-fixer and added a raw-path-token regression test.
* security: keep substituting a token that follows a backslash in substitute_script_path
Mirror the 1.2.x fix (#8238): the scanner's backslash branches consumed the next
character unconditionally, so a legacy/custom template token such as \<arg> never
reached the matcher and the trailing cleanup stripped it to a bare backslash. Both
branches now only pair the backslash with a following quote/backslash (so an escaped
quote still cannot toggle quote-state); any other character - notably a <token> start -
leaves the backslash on its own and is processed on the next iteration. Reformatted per
php-cs-fixer and added a backslash-before-token regression test.
* security: normalize dangling backslash before substituted value in substitute_script_path (GHSA-5v3j)
A template backslash immediately before a <field> token (\<arg1>) escaped the
already-escaped value's opening quote, producing \'...' which the shell rejects
with an unmatched-quote error (odd backslash runs) or prepended a stray literal
backslash (even runs). The quote-aware scanner now sheds one backslash when the
run immediately preceding a self-quoted value is odd, in both the unquoted
in-place branch and the close-around branch, so the value's own quotes always
function as the shell's quotes and $(...)/backticks inside it can never
re-activate.
The backslash regression test now executes each substituted template through
/bin/sh (printf %s) and asserts a clean parse plus a literal round-trip across
odd/even backslash counts, rather than pinning the generated string.
* fix(security): preserve literal backslashes in quoted script fields
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(security): cover changed guards and gate PR coverage
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* ci: measure committed PR changes on a policy-compliant runner
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* security: address review - nested cmd-sub/backtick handling, coverage gate, test skip
substitute_script_path() now follows the template's own $(...) and backtick
command substitutions as nested parsing contexts with their own quote state, so a
token placed inside one ("$(printf %s <field>)") is judged against that fresh
context instead of a suspended outer double quote. This closes the
nested-reinterpretation bypass where an escaped value sitting inside a command
substitution could be re-activated by an outer double quote. Backslash pairing in
both the unquoted and double-quoted contexts now also neutralizes $ and backtick,
so an escaped command substitution (\$(...) or \`...`) is not mis-detected as live.
.github/workflows/pr-changed-coverage.yml: drop the hard-coded PR-number
allowlist so the job runs whenever the path filter selects it, rather than
silently skipping every unlisted PR once these merge.
tests/Unit/Security/ShellInjection/ScriptFieldShellRoundTripTest.php: skip when
either exec() or proc_open() is unavailable (the test launches the fixture with
exec() while the fixture itself uses proc_open()). The fixture adds 7 nested
command-substitution and backtick round-trip cases (90 -> 97), each proving the
field value echoes back verbatim with nothing inside it executing.
* fix(security): clear quote-empty flag on single-quote content; cover new parser branches
The stack-based substitute_script_path() rewrite left quoteEmpty set while emitting literal content inside a single-quoted region, so a template like '\<field>' wrongly took the exact-wrap branch and dropped the backslash (ScriptSubstitutionMatrix 'shell 56'). Clear the frame's quoteEmpty whenever a single-quoted character is emitted, matching the pre-rewrite fallthrough.
ScriptSubstitutionMatrix.php: add 8 explicit parser cases exercising the \/backtick nested contexts and escaped \$ / backtick pairing so every rewritten line is covered by the changed-coverage probe (1285 -> 1293).
* style: short array syntax and php-cs-fixer formatting in substitute_script_path
* test(security): tolerate formatting in spikekill escaping contract
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(spikekill): bind menu requests and protect mutations on develop
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(spikekill): validate real CSRF tokens and inline coverage
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* ci(coverage): install locked dependencies for Symfony CSRF probes
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* perf(spikekill): skip disabled float debug formatting
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(spikekill): enforce mutation scope and propagate RRD failures
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(spikekill): escape repair notes and cover window boundaries
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test: remove unused SpikeKill preference binding
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(security): reject unsupported nested shell grammar in #8237 (#8359)
* fix(security): reject unsupported nested shell grammar
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(security): exercise nested grammar rejection in CI coverage
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(security): reject script fields in backtick substitutions
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test: retain native security fixture evidence in changed coverage
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(security): reject ambiguous shell expansion contexts
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(ssrf): assemble insecure manifest schemes at runtime
The SSRF negative-test inputs in PackageManifestMatrix.php are rejected by
the import preflight policy, but storing them as clear-text URL literals
(http://, ftp://, file://) tripped SonarCloud php:S5332 and dropped the
New Code security rating to B. Join the scheme separator at runtime so the
fixture no longer carries clear-text literals while the assembled values
keep the exact insecure schemes the policy must reject. All 32 manifest
cases still pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(spikekill): drop dangling href in removeSpikes redirect check
The CSRF POST rewrite of removeSpikes replaced the GET href builder but
left checkForRedirects(data, href) referencing the now-undefined href,
throwing ReferenceError once a POST completed. Call checkForRedirects(data)
so a redirect response reloads (a POST has no GET href to follow).
Update the merged dom_dynamic_boundaries boundary test to exercise the
POST path: define csrfMagicToken and mock $.post instead of $.getJSON, so
it still verifies DOMPurify sanitization of spike results.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: TheWitness <1439914+TheWitness@users.noreply.github.com>
Co-authored-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(ui): enforce dynamic DOM rendering boundaries
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test(ui): run DOM boundary checks with browser dependencies
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* ci(ui): fail the browser job on either regression failure
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix: Make boost_redirect the default boost behavior
Port of the 1.2.x change (issue#8470) to develop. Boost redirection is now
permanent whenever boost is enabled, so the boost_redirect setting is removed
and the collector always stages poller output directly into
poller_output_boost.
- cmd.php: drop the boost_redirect guard; stage whenever boost_rrd_update_enable
is on.
- include/global_settings.php, settings.php: remove the boost_redirect setting
and its UI toggles.
- lib/snmpagent.php: always report the redirect object as enabled.
- poller.php, settings.php: stop force-setting boost_redirect for multi-poller
installs (boost_rrd_update_enable alone now implies redirection).
- lib/boost.php: boost_poller_on_demand() no longer stages inline; cmd.php owns
staging, so it only reports rows as already staged and never re-inserts.
Tests are updated to match the single, permanent-redirect pipeline: the
hand-off acknowledgement and consolidation contracts point at the surviving
cmd.php/poller_recovery.php call sites, and the PollerOutput probe drops the
now-dead redirect-off staging scenarios.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test(coverage): cover the permanent Boost redirect in snmpagent
Add a request-coverage probe that exercises the permanent
boostApplRrdUpdateRedirect assignment in snmpagent_global_settings_update().
The statement lives in a MibCache-driven function that cannot run under the
unit/integration coverage driver without a live SNMP agent cache, so the
single changed line is compiled at its original line number and executed
against a minimal MibCache stand-in, with Xdebug coverage remapped to
lib/snmpagent.php. Register the probe so the changed-PHP coverage gate runs
it whenever lib/snmpagent.php changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* i18n:
* tests: Cover the cmd.php Boost flush guards for the changed-line gate
Making boost_redirect the default removed the boost_redirect half of the three poller flush conditions in cmd.php, leaving bare read_config_option(boost_rrd_update_enable) guards at lines 392, 501, and 537. Those statements live in cmd.php top-level poller loop, so the unit/integration driver includes them in the denominator but never executes them, dropping changed-line coverage to 3 of 6 (50 percent).
Adds a request-coverage probe that compiles each changed guard at its original line number and executes it against minimal read_config_option/boost_flush_output_batch stand-ins, mirroring the existing snmpagent redirect probe. Xdebug hits are remapped to cmd.php, raising changed-line coverage to 6 of 6 (100 percent). Registers the probe in run_request_coverage.sh so it runs whenever cmd.php changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(boost): keep the boost_redirect compatibility flag enabled
Port the poller.php compatibility assignment from the 1.2.x change
(#8559, commit ba2ab827) that this develop port dropped. Supported
Spine versions still read the hidden boost_redirect flag to stage
poller output into poller_output_boost; without it a compatible
collector never stages, yet boost_poller_on_demand() still reports
the rows as staged and poller_acknowledge_output() deletes them,
losing samples. Set the flag unconditionally before launching
collectors so redirection stays permanent whenever Boost is enabled.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: Fix php deprecation of spl_object_hash in php 8.6
Replaces spl_object_hash() calls to address the PHP 8.6 deprecation.
Adds cacti_object_hash(), which uses spl_object_id() to produce a stable 32 character hash string, and migrates the database connection and affected-row tracking in lib/database.php to the helper. Boost already keys its per-connection packet-limit cache on spl_object_id() on develop, so no change is needed there.
Adds tests/Unit/CactiObjectHashTest.php covering hash format, determinism, uniqueness, and the non-object false return.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* tests: Cover cacti_object_hash connection-tracking paths in database.php
The changed-PHP-lines coverage gate fell below 80 percent because the cacti_object_hash() swaps in db_check_reconnect(), db_close(), and db_execute_prepared() (the DEBUG_SQL_CONNECT branches) were not exercised. Adds a unit test that drives those paths with a real PDO handle registered in \, raising changed-line coverage of lib/database.php to 7 of 8 lines (overall 10 of 11, 90.9 percent).
Every connection global these functions assign to is snapshotted and restored around each test so the shared connection state the rest of the suite relies on is not corrupted.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* tests: Move CactiObjectHashTest into the Core category folder
AGENTS.md requires unit tests to live in a category subfolder rather than the tests/Unit/ root. Moves the cacti_object_hash() helper test to tests/Unit/Core/ alongside the other core utility tests and updates its lib/functions.php include to dirname(__DIR__, 3) so it still resolves to the repository root.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* deps(deps): bump chart.js from 2.9.4 to 4.6.1
Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.9.4 to 4.6.1.
- [Release notes](https://github.com/chartjs/Chart.js/releases)
- [Commits](https://github.com/chartjs/Chart.js/compare/v2.9.4...v4.6.1)
---
updated-dependencies:
- dependency-name: chart.js
dependency-version: 4.6.1
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* fix(build): sync chart.js 4.x UMD bundle
chart.js 4.x no longer ships dist/Chart.js; its browser bundle is now dist/chart.umd.js, which auto-registers all controllers and exposes the global Chart like the 2.x build. Point sync-js at the new path and refresh the vendored include/js/Chart.js so postinstall and the JavaScript contract tests succeed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The XSS rule only modelled request variables, so stored text such as device
descriptions, graph titles, notes, SNMP strings and plugin hook output was
never reported. form_selectable_cell() prints its contents verbatim and had no
rule at all.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Single-quoted PHP gettext in <script> breaks when the French
translation contains an apostrophe. Use json_encode() as support.php
already does so the apostrophe is string data.
Fixes#8555
Co-authored-by: Maël Chouteau <mael.chouteau@pmbservices.fr>
* refactor(themes): remove the Carrot and Hollyberry themes
Both were near-copies of the classic stylesheet kept as examples; the 1.3.0 upgrade prunes their directories and moves anyone who selected them to Modern instead of the alphabetical fallback.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* docs(changelog): add fragment for #8526
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test: cover retired theme cleanup and handle deleted coverage files
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(a11y): [develop] correct labels, document semantics and duplicate IDs
Associates form controls with their labels, replaces obsolete tt markup, removes duplicate element IDs, and adds a native accessibility browser suite with its database fixture.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix(a11y): validate label IDs and recognize attribute escaping
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Commit 8471 bumped dompurify from 3.4.16 to 3.4.17 in package.json but left
the JavaScript contract test and the vendored include/js/purify.js at 3.4.16,
breaking the "JavaScript contracts" CI job on develop (test "DOMPurify is
pinned and generated from the matching npm release").
- Update tests/js/sync_js.test.mjs to expect dompurify 3.4.17 in both the
package.json pin assertion and the purify.js license-header match.
- Regenerate include/js/purify.js and include/js/purify.js.map from the
dompurify 3.4.17 npm release via build/sync-js.mjs (npm install postinstall).
All 78 JavaScript contract tests pass locally.
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* hardening(import): require a 2048-bit RSA key for Package signatures
Apply the 1.2.x key floor from #7194 to every Package verify and every key
develop trusts or stores, and stop trusting the legacy 512-bit Cacti key.
Refs #8460
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* docs(changelog): add fragment for #8464
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* ci(security): treat grv() and gnrv() as Semgrep request sources
The gating XSS rule missed the short request helpers, the header() rule trusted HTML escapers that do not stop an off-site redirect, and the advisory taint rules missed get_request_var().
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* ci(security): gate Semgrep on new findings for every event
The new sources also match values an earlier gfrv() validated, so a whole-tree result cannot gate pushes; a single job keeps results stable run to run.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>