182 Commits
Author SHA1 Message Date
Thomas VincentandTheWitness cb49f31ff9 Replace csrf-magic with maintained CSRF protection (#7744)
* build: add symfony/security-csrf

Backs the CSRF token core that replaces the vendored csrf-magic fork.

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

* test: fix security-csrf package path assertion

symfony/security-csrf ships CsrfTokenManager.php at the package root, not under src/.

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

* refactor: register the composer autoloader before the CSRF include

CSRF validation ran before the autoloader existed, which blocks any class-based guard.

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

* feat(csrf): add CactiCsrfGuard over symfony/security-csrf

Issues and validates session-scoped tokens; not yet wired into the request path.

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

* feat(csrf): accept pre-upgrade csrf-magic tokens during the grace window

Legacy tokens carry their own expiry, so the fallback closes itself without a config flag.

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

* feat(csrf): port the output buffer rewriter to CactiCsrfGuard

Keeps the hidden field name and JS globals that third-party plugins rely on.

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

* fix(csrf): use json_encode for the JS script context in rewriteBuffer

htmlspecialchars() protects the HTML attribute context but not the
<script> string literal, which relied on Symfony's token generator
never emitting a quote rather than being safe by construction.

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

* refactor(csrf): move the XHR shim to include/js as Cacti-owned code

It has been maintained by the Cacti Group since 2020 and is not an upstream package.

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

* refactor(csrf): retire the vendored csrf-magic fork

The procedural csrf_* surface stays as a deprecated shim so plugins keep working.

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

* feat(csrf): validate requests through CactiCsrfGuard

csrf-magic self-invoked from its own file; the guard is called explicitly.

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

* fix(install): stop gating the permission step on the csrf secret

Retiring csrf-magic removed the directory its default path lives in, and setStep() clamps to the first errored step, so no fresh install could advance.

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

* fix(csrf): key the legacy fallback on the raw secret bytes

refresh_csrf.php writes PHP source with a trailing newline, and trimming that yields a different HMAC key than csrf-magic used.

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

* fix(csrf): log when the guard degrades to disabled in a web context

The installer is the only web path that can reach it, and failing open in silence is not something csrf-magic could do.

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

* docs: changelog for the CSRF library replacement

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

* fix(csrf): mint the token before the session write callback closes it

csrf_startup() minted lazily from the output buffer callback, which runs after session_write_close()'s shutdown-function registration, so a token minted there on a legacy-fallback POST was silently dropped.

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

* fix(csrf): make refresh_csrf.php a no-op

Its default secret path no longer ships and live tokens are session-bound, not HMACs over the secret, so rotation neither worked nor did anything meaningful; running it during the upgrade grace window used to delete the legacy secret and kill validation for pre-upgrade tokens outright.

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

* fix(csrf): fall back to the old default secret path when reading it

csrf-magic tried its own directory as a second candidate regardless of $path_csrf_secret; the new reader only tried the configured path, so a site pointing $path_csrf_secret at a file that was never created lost the legacy-token grace window entirely.

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

* docs(csrf): point the JS header at its BSD license sidecar

The header reduces the original BSD terms to prose and the actual text sits in an unreferenced csrf.js.LICENSE, so add a pointer to it.

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

* fix(csrf): restore csrf_check()'s bool return and $fatal contract

The shim ignored $fatal and always returned void, so audit/audit.php's `!csrf_check(false)` evaluated `!null` (always true) and denied every request instead of getting a real pass/fail result back.

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

* docs: reference the pull request number in the changelog entry

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

* test: resolve includes through Cacti path constants

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

* test(csrf): enforce full coverage

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

* Harden CSRF fallback handling

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

* test(csrf): assert the component stays out of the index

Committing it would leave a second copy to drift against the lock.

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

* ci: align CSRF checks with PHP 8.2

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

* docs: normalize the CSRF changelog entry

* Fix CHANGELOG entry ordering

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

* test(csrf): support constrained test environments

* fix(csrf): narrow nullable guard state

* test: place CSRF coverage in security domain

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

* security(test): match disabled exec exactly

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

* ci: run CSRF coverage on PHP 8.3

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-09-18 00:16:39 -04:00
Thomas Vincent 3f52135d36 Harden installer cleanup and enforce coverage collection (#7993) 2026-09-05 18:38:09 -07:00
Thomas Vincent ead882172e Make installer completion fail closed and add test coverage (#7626)
* Make installer completion fail closed

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

* Add installer unit and Docker integration gates

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

* Require installer coverage evidence

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

* Stabilize installer failure scenarios

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

* Address installer review feedback

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

* Reject incomplete installer selection payloads

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

* Match table validation to rendered controls

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

* Protect long-running installer migrations

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

* Load installer table metadata in one query

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

* Optimize installer completion queries

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

* Batch installer default settings writes

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

* Batch installer color upserts

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

* Batch installer template and poller lookups

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

* Refresh SQL interpolation baseline after develop rebase

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

* ci: use Cacti Composer test setup

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

* test: resolve includes through Cacti path constants

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

* ci: align installer workflows with policy

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

* ci: refresh security baselines after develop rebase

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

* ci: reuse TCP database credentials for installer checks

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

* test(security): refresh sink inventory baseline after rebase onto develop

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

* ci: run installer coverage on PHP 8.2

The 8.1 pin is below the ^8.2 composer requirement, so pest died in platform_check before any test ran.

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-08-31 16:59:49 -04:00
Thomas VincentandTheWitness 68d91f38d9 fix(installer): track all 1.3.0 migration writes (#7629)
* Track all 1.3.0 migration writes

* Use the standard test license header

* Fix NULL handling in plugin timestamp migration

---------

Co-authored-by: TheWitness <thewitness@cacti.net>
2026-08-10 12:34:19 -04:00
Thomas VincentandTheWitness f2a5ef0d51 fix: cast path_php_binary before passing it to string parameters (#7576) (#7577)
* fix: cast path_php_binary before passing it to string parameters

The setting has no default, so it is null on a fresh install, and PHP 9 turns
the resulting coercion from a deprecation into a TypeError.

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

* docs: append the changelog entry at the end of the issue block

Matches .github/copilot-instructions.md, which appends rather than inserting
in numeric order.

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

* test: use the full licence header on the new test files

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

* fix: cast path_php_binary at every site that escapes it

The first pass covered three of them; a repo-wide scan found 21, and the test
now fails if a new one appears.

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

* test: strengthen PHP binary path guard

* fix: cover default-config PHP binary reads

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-08-06 09:42:52 -04:00
c741f71c5c refactor(mail): replace PHPMailer with Symfony Mailer (#7190)
* refactor(mail): replace phpmailer with symfony mailer

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

* style(codex): fix coding standards in Symfony Mailer migration

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

* fix(codex): fix TLS downgrade bug and From address overwrite in Symfony Mailer

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

* fix(codex): guard SMTP stream setTimeout calls behind SocketStream check

setTimeout() exists on SocketStream only; getStream() is typed AbstractStream, which fails PHPStan level 6.

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

* fix(codex): correct inline graph CID, mandatory STARTTLS, and address validation in Symfony Mailer

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

* fix(codex): test inline CID, STARTTLS enforcement, and address-error handling

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

* fix(mail): qualify bare local addresses so sendmail recipients still work

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

* fix(mail): prune the stale PHPMailer vendor tree on upgrade

Replacing PHPMailer with Symfony Mailer dropped phpmailer from composer.json,
but the change also removed the prune_deprecated_files entries that cleaned up
the vendored tree, so an upgraded install would keep stale PHPMailer code on
disk. Add include/vendor/phpmailer (whole directory) to the prune list.

Co-Authored-By: Oz <oz-agent@warp.dev>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(mail): address transport review feedback

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

* fix(mail): drop setAutoTls() call missing from symfony/mailer 6.4

EsmtpTransport::setAutoTls() only exists in symfony/mailer >= 7.1, and the
6.4 series (needed for PHP 8.1) has no switch to disable opportunistic
STARTTLS, so hide the advertised capability in a small subclass instead.

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

* fix(mail): vendor the psr/log 1.1.4 sources

include/vendor/psr/log was tracked with only its package metadata, so
composer treats it as installed and never extracts the classes. That was
harmless while nothing loaded them, but Symfony Mailer's AbstractTransport
instantiates Psr\Log\NullLogger on every transport, which now fatals at
runtime and in the test job.

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

* fix(mail): match PHPMailer SMTP and attachment semantics

Empty secure modes use no-STARTTLS transport; inline disposition
is honoured; unreadable attachments fail closed.

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: Thomas Vincent <thomas@vincent.dev>
Co-authored-by: Oz <oz-agent@warp.dev>
2026-07-15 08:30:24 -04:00
Thomas VincentandTheWitness a610887bc9 Add Composer binary path setting with installer detection (#7271)
* Add Composer binary path setting with installer detection

First half of #6456: the path setting, auto-detection, and a
runnability probe on the Binary Locations step. Ref #6456

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

* Normalize Windows path in composer probe

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

* Use line comment per cs-fixer

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

* Re-ordering issue per spec

ChangeLog is order as follows:

1. Issue first, in numeric order
2. Features next in numeric order
3. For issues and features that do not have a number, they should be at the bottom of each section.

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-07-13 10:39:32 -04:00
Thomas VincentandTheWitness 7a1e9bbf92 harden CSV encoding and process execution handling (#7196)
* fix: harden CSV encoding and process execution handling

Route CSV export cells through a shared cacti_csv_cell() helper so values with quotes, commas, or leading formula characters round-trip correctly, and add defensive guards on shell construction, unchecked proc_open handles, discarded exec exit codes, and gap values in nth-percentile fetch math.

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

* fix: address review feedback on CSV and process hardening

- escape poller_id in cmd_realtime proc_open command to match remote_agent

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

* fix: keep numeric CSV cells unquoted and guard snmptrap and rrdtool process failures

- exempt numeric values from the CSV formula-injection prefix and preserve empty snmptrap positions while bailing out when the RRDtool process fails to spawn

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

* ci: ignore phpstan function.alreadyNarrowedType identifier

Clears the level 6 alreadyNarrowedType error on lib/data_query.php:2591 that
develop currently emits, matching the sibling narrowing identifiers already ignored.

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-06-24 09:43:16 -04:00
Thomas VincentandTheWitness d9de6dff57 fix: logic and security bugs in 1.3.0 upgrade scripts (#7161)
* fix: correct logic and security bugs in upgrade scripts

install/upgrades/1_3_0.php:
- case 11 (hourly reports): was an unreachable duplicate case 10; fixes
  all hourly report rows being silently skipped during migration
- case 11: add missing comma between enabled and recur_every in SET clause
- settings/settings_user.name: restore to varchar(255) to match final
  schema; 1_2_31 widened it, 1_3_0 was incorrectly narrowing it to 75
- db_add_index -> db_install_add_key for all 5 index-creation calls so
  that index failures surface in the upgrade status tracker instead of
  being silently discarded

install/functions.php:
- install_unlink/install_rmdir/install_rmdir_recursive: add missing
  return after the CACTI_PATH_BASE guard; without it the path-escape
  log message was emitted but execution fell through to the destructive
  unlink/rmdir anyway
- import_colors: replace string-interpolated SQL with prepared statements
  and add hex-format validation (/^[0-9a-fA-F]{6}$/) to prevent SQL
  injection from a modified colors.csv

cli/upgrade_database.php:
- use db_execute_prepared for the final version stamp to be consistent
  with adjacent calls and eliminate the direct-concat pattern

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

* fix: use realpath() for canonical base-path boundary check in install helpers

str_contains($path, CACTI_PATH_BASE) is bypassable: a path like
CACTI_PATH_BASE.'/../other' contains the base as a substring but
resolves outside it. Replace with realpath() on both sides and
str_starts_with() on the resolved paths. Fail closed when realpath()
returns false (non-existent path).

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-05-16 12:59:59 -04:00
Thomas VincentandTheWitness bec0792bbb fix: add PHPStan level 8 type guards to install/functions.php (#6755)
* fix: add PHPStan level 8 type guards to install/functions.php

Add defensive type checks (is_array, !== false, int casts) to resolve
PHPStan level 8 errors. No behavioral changes for normal operation;
only error paths (db failure, file open failure) are affected.

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

* test: add 55 Pest tests for PHPStan type guard patterns

Cover 10 defensive guard categories with stub-based unit tests:
db result array|bool, fopen false, chown params, imagecolorallocate
clamping, session_name fallback, shell_exec cast, preg_match offsets,
version_to_bits float, pclose guard, foreach iterable guard.

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

* fix: return false when fopen fails in install helpers

Ensure install_create_csrf_secret and remote_update_config_file
report failure when fopen returns false.

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

* revert: restore api_aggregate.php to develop state

Remove accidental deletion of aggregate_handle_stacked_lines() and
aggregate_get_data_sources() from pollution commit 94cb5faad.
Also fix pre-existing lib/dsstats.php alignment and PHPStan bootstrap order.

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

* fix: guard json_decode null return when shell_exec output is empty

json_decode() returns null on empty/invalid input; accessing keys on null
fatals in PHP 8. Use null coalescing to fall back to an empty array so
the caller safely sets filename and name without error.

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-03-06 23:21:52 -05:00
3e1dc3c886 fix: replace strtolower/strtoupper with locale-independent wrappers (#6717)
* cleanup: remove unreachable defensive error logs in aggregate graph item validation

* fix: replace strtolower/strtoupper with locale-independent wrappers

PHP 8.5 deprecates locale-sensitive strtolower() and strtoupper().
Add cacti_strtolower() and cacti_strtoupper() wrappers that use
mb_strtolower/mb_strtoupper with explicit UTF-8 encoding, then
replace all 185 call sites across 65 files.

Existing mb_strtolower() calls (email normalization) are left as-is
since they already specify encoding explicitly.

Includes 18 Pest tests covering ASCII, UTF-8, protocol names, config
values, hex strings, NaN detection, and file extension patterns.

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

* fix: correct docblock references and month_shift() strpos check

Fix docblocks to reference strtolower()/strtoupper() (the deprecated
PHP builtins) instead of the wrapper names. Fix month_shift() to use
strpos() !== false instead of > 0 so 'month' at position 0 is matched.

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

* chore: drop unrelated lib/api_aggregate changes

Keep PR scope focused on the issue for this branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-03-05 19:51:02 -05:00
Thomas VincentandTheWitness fcbcbdd1d7 refactor: replace strpos() boolean checks with str_contains/str_starts_with (#6645)
* refactor: replace strpos() boolean checks with str_contains/str_starts_with

Completes the PHP 8.x string function migration started in lib/.
Converts remaining legacy patterns across 81 files:

- strpos($x, $y) !== false → str_contains($x, $y)
- strpos($x, $y) === false → !str_contains($x, $y)
- strpos($x, $y) != false  → str_contains($x, $y)
- bare if (strpos($x, $y)) → if (str_contains($x, $y))
- substr($x, 0, strlen($y)) == $y → str_starts_with($x, $y)

Intentionally preserves strpos() calls that use the return value as
an integer offset:
- user_admin.php / user_group_admin.php (4 calls, ternary for position)
- auth_profile.php (2 calls, offset for substr); guards fixed from
  bare if ($pos) to if ($pos !== false)

Behavior fix: ss_esxi_vhosts.php:55 bare strpos() missed position-0
matches; str_contains() now correctly detects 'not installed' at any
position. Adjacent line already used str_contains().

Ref: https://github.com/Cacti/cacti/issues/6641

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

* fix: correct dead-code elseif in plugin_display_compat() version comparison

The if/elseif chain in plugin_display_compat() checked >=, >=, >, <
— the second >= was unreachable dead code. Corrected to <= to complete
the operator set (>=, <=, >, <).

Without this fix, <= constraints (e.g. "<=1.2") fell through to the <
branch and were rendered as "< =1.2" instead of "<= 1.2".

This pre-existing bug was exposed when converting strpos() to
str_contains(), which made PHPStan detect the always-false condition.

Ref: https://github.com/Cacti/cacti/issues/6641

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

* fix: add limit to explode('=') in CLI argument parsers

17 CLI scripts used explode('=', $parameter) without a limit of 2,
silently truncating values containing = (e.g. --note=a=b parsed as
$value='a' instead of 'a=b'). The other 40 CLI scripts already had
the correct limit.

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-02-25 11:38:59 -05:00
TheWitness 27919c50d7 Updating Copyrights to 2026 (#6578) 2026-01-28 16:11:10 -05:00
TheWitnessandCopilot b993471579 Fix #6539 - Allow Standard Cacti Log Files to be Rotated on Demand,PHPdoc, and Typing (#6540)
* Fix #6539 - Allow Standard Cacti Log Files to be Rotated on Demand from the Cacti UI

* QA: php-cs-fixer updates and documentation for lib/database.php

* QA: Update .gitignore for composer files

* QA: Update .gitignore for composer files

* QA: Back off .gitignore change its duplicated

* QA: Fix typing of db_has_permissions

* QA: Fixing typing issue in db_format_index_create

* Update lib/clog_webapi.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* QA: Fix additional code issues

* QA: Applying more defaults to add device

* QA: Fix at the database layer

* QA: Fixes based upon automated testing

* QA: Fix at the database layer

* QA: After new SQL checking

* QA: Skip MacTrack oui database download warnings

* QA: Fixing type issue

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Some minor changes to avoid errors in testing

* QA: Unused variable

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Recommendation from Copilot

* QA: Minor introduced code defect

* QA: Adding some unifying space around concatination

* QA: Consistent comments and new function alias'

* QA: Multi-line comment corrections

* QA: Fix SQL Style

* QA: Missed one function alias

* QA: PHPStan Level 2 and PHPDoc fixes

* QA: PHPStan Level 2 and PHPDoc Fixes

* QA: PHPStan Level 6 Fixes

* QA: Fix lib/xml.php to PHPStan Level 6

* QA: Wrong grep -v

* PHPStan Level 6 for lib/vdef.php

* PHPStan Level 8 for lib/time.php

* QA: Raise PHPStan to Level 6 for lib/database.php

* QA: Remove @deprecated tag from grv()

* QA: Switch to htmle() alias over html_escape()

* QA: More addressing PHPStan issues at Level 6

* QA: Change recommended by Copilot for Readability

* QA: More PHPStan fixes

* QA: More PHPStan fixes

* QA: More PHPStan fixes for lib/utility.php

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: Raise PHPStan to Level 6 More Functions

* QA: More PHPStan fixes at Level 6

* QA: Some phpseclib3 fixups to update to latest

* QA: More fixups for graphing for magic strings

* QA: More PHPStan fixes at Level 6

* QA: Fixing order string type on get_allowed_graphs()

* QA: Fixing improper use of print

* QA: Optimization of color_templates

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Copilot recommendation

* QA: Raise PHPStan to Level 6 More Functions

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues insalling Cacti

* QA: Issues testing Cacti

* QA: Copilot recommendation

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: More PHPStan fixes at Level 6

* QA: Installer failing

* Undo ownership changes to remove tar errors

* QA: Updates after php-cs-fixer

* QA: Adding code checks to syntax checking

* QA Change syntax flow language

* QA: Reduce the number of cures

* QA: Use sequentional option

* Change runner to self-hosted for check job

* Fix typo in OS version in workflow file

* Add Git installation step in workflow

Added step to install Git if not already installed.

* Add '-y' flag to apt-get install and update commands

Updated apt-get commands to include '-y' for automatic confirmation.

* Change workflow OS version to 'ubuntu-latest'

Updated the workflow to use 'ubuntu-latest' instead of 'ubuntu:latest' and modified the 'runs-on' configuration.

* Remove sequential option from phpcsfixer script

* Remove PHPCS fixer step from workflow

Removed PHP coding standards check from workflow.

* Move code checks to before plugins

Moving these core checks to before the plugins are installed as we really want to check only the base Cacti here.

* Add Composer validation and caching to start of workflow

* QA: Addressing PHPStan additional

* QA: Restore composer lock file

* QA: Addressing PHPStan additional

* QA: Addressing PHPStan additional

* QA: Complete LDAP Project

* QA: php-cs-fixer doing it's thing

* QA: Syntax is already happening in PHPStan

* QA: The md5 function no longer exists

* QA: Update after ldap changes

* QA: Undo that last password hack

* QA: Attempting to switch to MariaDB 11.8

* QA: Attempting to switch to MariaDB 11.8

* QA: Resolving some issues with PHP8.4

* QA: Resolving some issues with PHP8.4

* QA: Add PHP8.5 to the matrix

* QA: Removing PHP8.5 due to dependency issues

* QA: Add the DB version to the testing output

* QA: Switch back to MySQL for the moment

* QA: More fidelity in reporting

* QA: The pipe must be mixed

* QA: Moving audit_schema.php changes from 1.2.x

* QA: Moving audit_schema.php changes from 1.2.x

* QA: Restore mysql monitoring

* QA: php-cs-fixer issues

* QA: Attempt to roll back to MariaDB 10.6

* QA: Attempt to fix check_all_pages.sh

* QA: Make installer functional again

* QA: Fix installer php-cs-fixer issues

* QA: Type to a string

* QA: Get the database version correctly

* QA: Fix issue with reports in check_all_pages.sh

* QA: Check the server version in the right place

* Feature: Support SHA256 as a new hash for passwords

* QA: Function definition and return typing audit

* QA: Refinement of form types

* QA: Refinement of form types

* QA: Consistency of comments

* QA: Issues with php-cs-fixer and more comments

* QA: More typing issues

* QA: php-cs-fixer on merge conflict resolution

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-25 10:13:56 -05:00
Petr Macek 629ee9bcf4 incorrect parameter (#6498) 2026-01-02 09:51:24 -05:00
TheWitness 3d7cd822b8 QA: Fixing additional files phpdoc specs 2025-11-18 23:22:24 -05:00
TheWitness 6e7d95f8cb QA: One more SSL issue 2025-08-18 13:33:35 -04:00
TheWitness 48c520cd28 QA: Correcting SSL Cert Verification Issues 2025-08-18 13:12:40 -04:00
TheWitness e5c4015e0e QA: Remove most references to $config
This removes most entries to $config in the base code.  A few new constants were defined to achieve this:

* CACTI_CONNECTION - The status of the current connection
* CACTI_CSRF_SECRET - The path to the csrf secret file
* CACTI_PHP_SNMP - True if php-snmp is installed
* CACTI_WHITELIST - The path to the Cacti Whitelist file if defined

I also moved several $config['poller_id'] to the existing POLLER_ID and move a number of $config['is_web'] to the existing CACTI_WEB constants.

There remain a few artifacts in the code.  They will be handled in a separate commit.
2025-03-22 16:48:59 -04:00
TheWitness 2c779273f9 Copyright Updates and PHP-CS-Fixer updates 2025-03-09 14:34:19 -04:00
TheWitness fb589c4267 QA: Fix: #6053 - Wrong constant use 2025-01-12 10:35:27 -05:00
TheWitness 36d20ae254 QA: Fix Remove functions 2025-01-10 11:50:07 -05:00
TheWitness dcbcb216c1 QA: Handle removal of old files 2025-01-08 19:19:02 -05:00
TheWitness 4a01ef7f05 QA: Tweak a few Reports visual settings 2025-01-05 14:49:05 -05:00
TheWitness 81e38e2a11 QA: We are adding a column 2024-12-30 22:19:01 -05:00
Petr Macek c0603dcf52 fix 6023 (#6027) 2024-12-29 16:44:15 -05:00
TheWitness 67b0283dbe QA: Improve installation fail wording 2024-12-22 13:28:40 -05:00
TheWitness 467c758c4f Fix: #5837 - Don't allow Remote install to older main Cacti 2024-12-22 11:16:14 -05:00
TheWitness 24d988cc66 QA: #5858 - Reporting Changes
* As part of the reporting project remove reports_user.php and rename reports_admin.php to simply reports.php.
* Control permissions by realm and not file in this case.
2024-12-15 09:43:11 -05:00
TheWitness f3a6eb3ff4 Fix: #5968 - Remove jquery sparklines
* Removing jQuery Sparklines API as we are not using it and have adequate charting libraries
2024-12-08 07:59:49 -05:00
TheWitness 40fe5b174c Fix: #5967 - Remove dygraph-combined.js
Removing dygraph-combined.js as we are not using it and have adequate charting libraries
2024-12-07 09:29:33 -05:00
TheWitness 9193a49a7b Fix #5588 - Add integrated plugins from removal list 2024-12-03 13:21:15 -05:00
TheWitness 10f28874bb Fix: #5588 - Remove deprecated files/libraries
* When upgrading Cacti deprecated/removed libraries and files still exist
* I went back to 0_8_x and started from there.
* Included recent changes like removal of c3 and consolidation of billboard.js to central css location.
* I did not remove the Cacti theme
2024-12-01 17:50:32 -05:00
TheWitness 6798849888 QA: Fix one typo in #5933 2024-11-29 12:43:51 -05:00
TheWitness 31ef2d68bf Fix #5933 - Only change charset and engine for base tables
* Many plugin tables desire specific engines and charsets
2024-11-29 12:26:24 -05:00
TheWitness f3d32c854a Fix #5932 - Replicate happens repeatedly 2024-11-29 11:12:14 -05:00
Petr MacekandTheWitness d70a747687 add NIMBLE/ALLETRA template 1.3 (#5922)
* add NIMBLE/ALLETRA template

* update

---------

Co-authored-by: TheWitness <thewitness@cacti.net>
2024-11-15 08:25:36 -05:00
TheWitness b4bf96f632 QA: Fixing a possible user directed RCE when installing Cacti 2024-08-04 11:58:43 -04:00
TheWitness 9f82109fbb Fixing #5754 and #5759 - Installer Issues
-issue#5754: Installer replication loop for. Plugin realms
-issue#5759: Remote poller attempts to sync with other pollers during install
2024-07-04 19:33:20 -04:00
TheWitness 3a9deab03c QA: New location for Windows Net-SNMP install 2024-04-15 18:34:44 -04:00
TheWitness 5f78605e28 Fixing #5723 - Remote poller install does not finish
Remote Poller installation is finished successfully but no "finish" button
2024-04-15 18:28:31 -04:00
Petr Macek 0b5d7249cb add Aruba Clearpass template (#5717)
* add template

* add template

* update
2024-04-12 09:24:17 -04:00
TheWitness 2f7c9d0ad4 Merge branch 'develop' of https://github.com/Cacti/cacti into develop 2024-02-18 12:16:02 -05:00
TheWitness 610eed7009 Fixing #5662 - PHP 8 Issues
installer - Undefined array key "name" warning in php8
2024-02-18 12:15:36 -05:00
Bongjae ChangandTheWitness e1c77763ad Fixed "installer - Undefined array key "name" warning in php8" (#5663)
* Fixed "installer - Undefined array key "name" warning in php8"
- https://github.com/Cacti/cacti/issues/5662

* Fixed "ping - Ping Result not reported properly".
- https://github.com/Cacti/cacti/issues/5665

* Update functions.php

* Update ping.php

Minor updates for Windows

---------

Co-authored-by: TheWitness <thewitness@cacti.net>
2024-02-18 12:14:35 -05:00
TheWitness 1aa72d24c9 QA: Update Copyright to 2024 2024-02-03 14:18:57 -05:00
Linegod f2d64b2075 typos 2023-11-30 22:29:13 -06:00
Petr Macek a622b6cb0f add template for Aruba OSCX 6x00 switch (#5596)
* add template for Aruba OSCX 6x00 switch

* update
2023-11-23 10:31:30 -05:00
Petr Macek 708fabc8ab 1.3: New templates - Aruba switch, Aruba controller, HPE iLO (#5578) 2023-11-18 09:13:41 +00:00
jkbzhandJose Kahan d5615333e4 Support for PDO::MYSQL_ATTR_SSL_CAPATH and PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT (#5522)
* Make PDO::MYSQL_ATTR_SSL_CAPATH and PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT
accessible thru $database_ssl_capath and $database_ssl_verify_server_cert
configuration options.

* typo: wrong variable name

* fixing typo

---------

Co-authored-by: Jose Kahan <jose.kahan@w3.org>
2023-10-04 18:16:26 -04:00