87 Commits
Author SHA1 Message Date
TheWitnessandTheWitness 3ab4c69fb7 PHPStan Level 8 - Phase 1 Conversion (#8135)
* PHPStan Level 8 - Phase 1 Conversion

Reduces the real (no-baseline) PHPStan level 8 error count from ~2,724 to 425
and regenerates phpstan-baseline.neon accordingly (8,941 -> 1,921 lines).

Core type-safety changes
- lib/database.php: narrow db_fetch_row()/db_fetch_row_prepared() to return
  array (was bool|array) and db_fetch_assoc()/db_fetch_assoc_prepared() to
  return array (was mixed); the _prepared workers coerce the connection-failure
  path to an empty array so the declared type is honest. empty()/cacti_sizeof()
  checks are unaffected.
- lib/database.php: narrow $db_conn guards from is_object() to instanceof PDO in
  the transaction/quote/insert-id helpers so the PDO calls resolve.
- lib/mib_cache.php: the fluent MibCache methods mib()/object()/table()/row()
  now return self instead of a bare object so chained calls type-check.

Type-safety casts and guards (mechanical, behaviour-preserving)
- Cast string|false/|null builtin results feeding string parameters
  (json_decode, base64_encode, trim, htmle, preg_replace, explode, etc.).
- Cast int|string / int|false values feeding int id/pid parameters.
- Guard resource|false fopen()/popen() handles before fwrite/fclose/fread, and
  wrap foreach over array|false/list|false results with `?: []`.

Genuine bugs found and fixed
- cli/add_tree.php / lib/api_tree.php: site tree nodes could not be created via
  the CLI - the --site-id option was never parsed, $nodeTypes had no 'site'
  entry (passing null to api_tree_item_save(int $type) -> TypeError), and
  api_tree_item_save() never persisted site_id. All three fixed.
- tree.php: leaves_exist() is typed : int but returned db_fetch_assoc_prepared()
  (an array of rows) for a SELECT COUNT(*); now uses db_fetch_cell_prepared()
  and returns the scalar count.
- lib/mib_cache.php: $entries_per_object was a float (division / ceil) used as
  an array key (PHP 8.1 implicit float-to-int key deprecation); now cast to int.

Config
- .phpstan.neon: add notIdentical.alwaysTrue and booleanAnd.alwaysFalse to the
  existing always-true/false ignore family (same "PHPStan gets confused"
  dynamic-constant cause already covered by identical.alwaysTrue,
  notEqual.alwaysTrue, booleanAnd.leftAlwaysTrue, etc.).
- phpstan-baseline.neon: regenerated; the remaining 425 entries are the
  untouched long tail for Phase 2.

* Remove redundant @phpstan-ignore comments

Follow-up cleanup for the level 8 Phase 1 work. Removes 14 inline
@phpstan-ignore comments that no longer suppress any reported error:

- cli/repair_database.php: `@phpstan-ignore booleanAnd.alwaysFalse` is now
  covered by the global booleanAnd.alwaysFalse ignore added to .phpstan.neon.
- 13 others (host.php, include/global.php, include/session.php,
  lib/api_automation.php x2, lib/functions.php x2, lib/html_utility.php x2,
  lib/installer.php, lib/package.php, lib/reports.php, lib/rrd.php) no longer
  match any reported error after the type-safety fixes (e.g. the
  db_fetch_row_prepared() return-type narrowing removed the offset-assign
  errors the api_automation ignores were suppressing).

Verified with reportUnmatchedIgnoredErrors enabled: 0 unmatched ignores
remain and the full level 8 run still reports 0 errors.

* ci: satisfy validator ratchet and refresh security sink baselines

- lib/api_tree.php: give the new tree-item site_id a real numeric
  constraint ('^[-0-9]+$', matching html_reports.php) instead of an
  empty regex, so the validator constraint ratchet passes without
  bumping its baseline.
- tests/security/baselines: refresh the three sink/hotspot signatures
  whose code text changed from the (string) casts added in this branch
  (lib/poller.php setsid, cli/rrdresize.php json_encode, lib/import.php
  simplexml_load_string).

* ci(js): allow DOMPurify 3.4.16 and update sync_js pin test

The dependabot bump (#8134) moved package.json/package-lock.json to
DOMPurify 3.4.16 on develop but left tests/js/sync_js.test.mjs pinned to
3.4.15, so the PR merge commit fails the 'DOMPurify is pinned' contract.
Bring package.json/package-lock.json to 3.4.16 (matching develop) and
update the pin test to expect 3.4.16.

* test: update sql.php null-handling assertion for the (string) cast

This branch changed scripts/sql.php from trim(\ ?? '') to
trim((string) \) (the phpstan-safe form that coerces both null and
false from shell_exec()). Update SqlScriptsTest's null-return assertion
to match the new cast instead of the removed '?? ''.

* fix: address Copilot review - ownership IDs, fopen guards, mib_cache bound

- chown()/chgrp(): pass integer UID/GID from fileowner()/filegroup()
  (guarding the false lookup) instead of string-casting them, which made
  them resolve account/group names like '1001' and fail. Covers
  lib/api_device.php, lib/boost.php and poller_maintenance.php (x2).
- fopen() failure now short-circuits instead of reporting success:
  lib/package.php returns false, lib/clog_webapi.php and utilities.php
  render an error, and snmpagent_mibcachechild.php skips the cache write
  and sentinel unlink so a concurrent writer's lock is preserved.
- lib/mib_cache.php: keep the float quotient as the loop bound and cast
  only the array offset, so a non-even entries/columns split no longer
  truncates the loop and drops a cached row.

* revert: keep db_fetch_* returning false on error; baseline Level 8 instead

Per review, restoring the intentional fail-safe: db_fetch_row[_prepared]()
return bool|array and db_fetch_assoc[_prepared]() return mixed again, so a
genuine SQL error (not just a missing connection) is signalled as false and
the === false checks in cdef_is_in_use(), boost_process_* and aggregate.php
work as before. Dropped the is_array() ? : [] coercion.

Level 8 stays green by regenerating phpstan-baseline.neon to capture the
re-introduced bool|array/mixed call-site errors (the ~1,850 the narrowing
had eliminated). Tightening those callers to drop them from the baseline is
Phase 2 work.

---------

Co-authored-by: TheWitness <copilot@users.noreply.github.com>
2026-10-02 10:08:56 -04:00
Thomas VincentandTheWitness a6da63ac89 Harden remote graph transport and response validation (#7631)
* Harden remote graph transport boundaries

* Tighten remote graph SVG validation

* fix: PHPStan Issues with emerging code

* Refresh security baselines after develop rebase

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

* Match transport test to the explicit response-header default

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-08-11 08:16:48 -04:00
db6a1637b5 fix(security): close validator migration regressions (#7240)
* feat(validator): add settings constraint validation pilot

Routes saved settings through Symfony Validator so include/global_settings.php
can declare per-setting constraints inline. The save handler runs one
validator pass and surfaces violations via the existing raise_message()
pattern, replacing scattered ad-hoc checks. Pilot covers 12 high-value
settings; the rest stay on the existing implicit form-render checks.

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

* ci(infection): allow infection/extension-installer composer plugin

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

* docs(validator): document must-be-posted-to-validate contract

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

* fix(bootstrap): guard Symfony autoload in global_settings before use declarations

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

* fix(test): remove redundant autoload require in CactiSettingsTest

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

* fix(test): restore require_once for CactiSettings (not in Composer autoload)

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

* feat(validator): fold helper into settings pilot

* fix(validator): translate default Symfony constraint messages

Default Symfony NotBlank/Length/Range/Choice/Positive messages render
in English regardless of Cacti locale because the validator runs
without a Symfony Translator. Pass explicit __()-wrapped message,
minMessage, maxMessage, and notInRangeMessage options on each bare
constraint in include/global_settings.php so violations participate
in Cacti's gettext pipeline. Documents the no-Translator decision in
CactiValidator so future contributors know to translate at the call
site.

Addresses Copilot PR #7077 review feedback.

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

* fix(graph): improve remote agent parsing and RRD path validation

* feat(validator): migrate automation_graph_rules.php to symfony validator

* refactor(validator): move automation validator helper to shared library and enhance tests

* feat(validator): migrate automation_networks.php to symfony validator

* feat(validator): migrate automation_snmp.php to symfony validator

* feat(validator): migrate automation_templates.php to symfony validator

* feat(validator): migrate automation_tree_rules.php to symfony validator

* refactor(automation): move api_networks_save to shared library for testability

* feat(validator): add validateInput helper and migrate color_templates.php

* feat(validator): migrate host_templates.php to symfony validator

* feat(validator): migrate graph_templates.php to symfony validator

* feat(validator): migrate data_templates.php to symfony validator

* feat(validator): migrate data_input.php to symfony validator

* feat(validator): migrate data_queries.php to symfony validator

* feat(validator): migrate graphs_new.php to symfony validator

* feat(validator): migrate graphs.php to symfony validator

* feat(validator): migrate data_sources.php to symfony validator

* feat(validator): migrate user_group_admin.php to symfony validator

* feat(validator): migrate managers.php to symfony validator

* feat(validator): migrate package_repos.php to symfony validator

* Refactor pollers.php to use CactiValidator

* fix(security): close validator migration regressions

* test(snmp): add spine docker harness

* fix(review): address validator migration feedback

* fix(deps): include validator runtime packages

* chore(deps): normalize composer.json require-block indentation

The validator migration introduced tab-indented entries in an otherwise
space-indented require block. Re-indent the stevenmaguire/* and symfony/*
lines to 8 spaces so the block is consistent.

Co-Authored-By: Oz <oz-agent@warp.dev>

* fix(graphs): repair graph json response branch

* fix(validation): apply php cs fixer

* ci(codeql): skip autobuild for interpreted scans

* fix(link): satisfy phpstan path guard

* chore(pr): remove branch pollution

* ci(codeql): align autobuild pin with init and analyze

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

* refactor(automation): use CactiValidator::validateInput, drop wrapper

automation_validate_input() in lib/api_automation.php was a byte-for-byte
duplicate of CactiValidator::validateInput() (identical session handling and
raise_message() semantics, and it already delegated to CactiValidator::validate
internally). Per review feedback, use the shared class directly everywhere
instead of a parallel automation-only wrapper.

- Remove automation_validate_input() from lib/api_automation.php
- Replace all call sites with CactiValidator::validateInput()
  (automation_templates/graph_rules/tree_rules/snmp and api_networks_save)
- Update the automation validator unit tests to match
- Add @param/@return PHPDoc to CactiValidator specific-validator methods

Co-Authored-By: Oz <oz-agent@warp.dev>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: Thomas Vincent <thomas@vincent.dev>
Co-authored-by: Oz <oz-agent@warp.dev>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-07-13 15:13:59 -04:00
Thomas VincentandTheWitness c65f56d7e1 fix(graph): correct graph subsystem bugs (#7186)
* fix(graph): correct graph subsystem bugs

* Address graph PR review findings

* style: convert new code to short array syntax

php-cs-fixer flagged array() in graph_realtime.php; convert to [] for the
coding-standards gate.

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

* build: pin phpstan to 2.2.1

phpstan 2.2.2 added a stricter is_numeric() always-true inference that
fails on pre-existing develop code (lib/data_query.php); pin until that
is addressed upstream so CI is reproducible.

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

* fix(rrd): key GPRINT CF cache per data source instance

Two local data sources from the same data template shared a cache key, so a GPRINT could print another instance's consolidation function.

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 15:32:51 -04:00
Thomas VincentandTheWitness 122bb88387 chore(security): harden report actions and theme handling (#7169)
* fix(security): align develop with advisory hardening

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

* fix(security): harden remote agent auth compatibility

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

* fix(security): reorder remote auth checks

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

* fix(security): harden remote_agent auth order and query scope

Move whitelist check before the single-poller guard so single-poller
installs relying on the whitelist are not incorrectly rejected.

Narrow SELECT * to SELECT hostname; the loop only reads hostname.

Drop function_exists guards around md5/hash; both are PHP core and the
raw $cache_seed fallback is unsafe as an APCu key.

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

* fix(theme): cast read_config_option result to string in cacti_validate_theme

read_config_option can return false or null when the setting is absent.
Without the cast, a strict comparison to '' would not match, leaving
$default unset and risking a null-typed value flowing into callers.

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

* fix(reports): skip invalid IDs in bulk action without aborting the loop

Replace input_validate_input_number (which calls die_html_input_error
on bad input, aborting the entire bulk action) with an inline guard.
Cast $report_id to int at call sites where the signature requires int.

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

* feat(security): comprehensive UI hardening and 7.4 normalization

- Refactored poller_spikekill.php to use array-based execution and sanitized SQL IN clauses.
- Refactored script_server.php Windows process check to use cacti_exec.
- Hardened snmpagent background process lifecycles.
- Standardized version checks in support.php and utilities.php.
- Replaced short array syntax [] with array() and verified 7.4 compatibility.
- Synchronized all hardened files to primary developer path.

* fix(snmpagent): replace undefined cacti_process_execute() with exec_background()

cacti_process_execute() was called but never defined, causing a PHP fatal.
Replaced with exec_background() from lib/poller.php. Also fix pre-existing
parse error in snmpagent_persist.php ([ closed with ) instead of ]).

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

* style: convert new code to short array syntax

php-cs-fixer (array_syntax/list_syntax short) flagged array() introduced
on this branch; convert to [] so the coding-standards gate passes.

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

* revert off-topic exec changes to match develop

poller_spikekill, script_server, snmpagent_persist/mibcache and support
had been switched to 1.2.x-style cacti_exec(), which is undefined on
develop and failed phpstan. Restore develop's native exec() idiom; these
files are outside this PR's scope (report actions and theme handling).

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

* build: pin phpstan to 2.2.1

phpstan 2.2.2 added a stricter is_numeric() always-true inference that
fails on pre-existing develop code (lib/data_query.php); pin until that
is addressed upstream so CI is reproducible.

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

* fix(reports): deserialize type-prefixed bulk items so actions run

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>

* fix: add missing PCRE delimiters to graph_template_id regexp filter

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

* fix(reports): parse the confirm list identically to the action branch

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

* refactor(remote_agent): drop the APCu auth cache (uncertain dependency, cross-request only)

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

* Enhance security checks for remote agent access

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-06-24 15:07:49 -04: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
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
TheWitness ac0c1c5c45 Switch from include to require 2025-04-03 14:37:02 -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 5f750482a1 Fixing #5725 - Remote Data Collector logging
Remote Agent is not recording not authorized agent in log
2024-04-15 18:52:05 -04:00
TheWitness 1aa72d24c9 QA: Update Copyright to 2024 2024-02-03 14:18:57 -05:00
TheWitness 0ee00bc622 Porting #5182 - Graph Image and Remote Agent
Graph Image does not have check for Remote Agent
2023-01-22 16:39:24 -05:00
TheWitness b6526b8597 Fixing #5163 & #5165 DSStats Enhancements
* Adds multiple percentile data to the Data Source Statistics tables
* Converts the Hourly Cache to InnoDB
* Some normalization rrdtool_function_graph() calling params outside of plugins
* Fix issues with variance and standard deviation calculations in graph_variables.php
2023-01-15 22:17:16 -05:00
Mark Brugnoli-Vinten 32ba2f19f4 Update copyright year for 2023 2023-01-03 20:34:26 +00:00
Mark Brugnoli-Vinten 8b29d12cc9 Define cacti system paths as constants for better code checking (#5120)
This also provides a full run of src-fixer against all files to
ensure all code is now in alignment.

Closes #5120
2023-01-01 01:03:15 +00:00
Mark Brugnoli-Vinten c8157e3cbb Switch to constants for common session/cookie options 2022-12-21 10:53:53 +00:00
TheWitness 82b229db9e Updating Copyright to 2022. 2022-02-06 17:16:20 -05:00
TheWitness df54a4a3f3 Updating copright years 2021-01-01 20:28:58 -05:00
TheWitness ced9f430f4 Partial resolution to low lighthouse score for performance #3402
* Cacti scores low on performance audit on lighthouse audit
* This change enables generic caching of pages, but with a very short age for RRDtool generated graphics.
* It increses the SEO score through the use of specialty tags on anchors leveraging the _blank target attribute value
* It removes and unnecessary tooltip on the document element

There may be additional changes forthcoming.  However, these changes raised the score from 0 to the mid twenties.

Some of the changes, like minification of JavaScript we do not do due to the nature of the project, but could be done by customers.  Once the page is first rendered, it's in the browsers memory and cached for a good time, so this is not a big deal.
2020-04-04 09:09:58 -04:00
TheWitness d65f40d2bf Abstract Cacti session handler 2020-03-29 19:08:29 -04:00
netniV b41014219e Unix timestamps after Sep 13 2020 are rejected as graph start/end arguments
Closes #3245
2020-02-22 00:43:56 +00:00
netniV 4fa9a68fb3 Update copyright to 2020 2020-01-12 12:19:49 +00:00
netniV 4cecb19f6b PHP Fatal error: Uncaught Error: Cannot pass parameter 5 by reference in graph_json.php:158
Closes #3104
2019-11-27 23:09:59 +00:00
ddb4github d5f98679a0 Fixed #3049(due to #2964) to add missed argv for most rrdtool_function_graph caller (#3087)
* Fixed: #2964 to add missed argv for all rrd_function_graph caller

* Fixed #2964: Apply security solution to aggregate graph preview and graph impage page
2019-11-17 14:15:41 -06:00
cigamit cfb0733597 Fixing Issue #2964 Differently
* CVE-2019-16723 Security issue allows to view all graphs
* Thischange restores the check inside of lib/rrr.php and updates all but on calling of the graph function to include the user.
2019-10-19 08:01:39 -05:00
cigamit 7a6a17252a Resolving Issue #2954
Security issue allows to view all graphs
2019-09-22 13:15:41 -05:00
netniV 308292e2d7 Update copyright notices for 2019 2019-01-25 08:05:00 +00:00
cigamit 2a1b980271 Resolving Issue #1428
Graphs: Add more information to error image
2018-05-11 18:31:20 -05:00
cigamit 9b48dfc4a8 Resolving Issue #1309
Provide meaningful authentication errors in graph_json.php and
graph_image.php
2018-02-06 19:28:29 -06:00
Tony Roman 519b35f5cd Update copyright to 2018 2018-01-06 09:10:15 -05:00
Wolfgang Stöggl 4a1a15d72c Correct spelling of RRDtool (#1038)
- Change RRDTool -> RRDtool with a lowercase t.
- Replace in all files except *.mo, *.po, *.pot
2017-10-16 11:32:05 -04:00
Tony Roman 8a179d7d7f Fix up to move if elseif else blocks to PSR 2017-05-07 19:57:36 -04:00
cigamit 68565a1536 Undefined variable warnings 2017-03-18 20:05:31 -05:00
cigamit a7b8c6fb20 Resolving Issue #407
The RRDfile does not exist message is misleading
2017-03-18 13:31:20 -05:00
cigamit 5597e07e81 Resolving Issue #199 2017-01-11 07:08:17 -06:00
Tony Roman 35a5988f41 Update source code files copyright to new year 2017-01-01 13:45:29 -05:00
cigamit b523f1dea5 remove addslashes, prepared statements, wc3 validation, double to single quote
this is required for preparation of magic_quotes_gpc.
2016-08-28 15:27:48 -05:00
cigamit c59b0a7e12 add theme support to reports 2016-02-14 12:12:25 -06:00
cigamit 22478523f3 default the graph type and remove developer mode log messages. 2016-02-13 09:28:44 -06:00
cigamit bf33b51819 more request variable debug
no need for developer log messages under some circumstances
2016-02-13 09:14:46 -06:00
cigamit 2387bd4a08 removing many $_GET, $_REQUEST, and $_POST variable usage
There are still three steps to go in this overall.  The first is to
replace all the page filtering session storing and validation functions
and the second is to propagate those changes into various areas of the
lib directory that include the use of the various variables, lastly,
developer mode will have to be enable to see if there are any variables
used in the code that have not been sanitized.  Note, at this point the
develop branch should be thought of as slightly unstable
2016-02-07 12:51:49 -06:00
cigamit da34108e21 remove use of deprecated function get_request_var_request(). replace it with get_request_var()
this is part three of project to remove the use of $_GET, $_REQUEST, and
$_POST in the code.  Parts one and two have already been completed.
Part one was to remove the use of $_GET throughout the code, part two
was the incorporation of wrapper functions to handle specific
validation, verification and sanitization cases.  This third part will
remove the use of the get_request_var_request() from the code.  Part
four, and beyond will include the removal of both $_REQUEST and $_POST
super globals from the code.
2016-01-30 15:53:08 -06:00
Micke2k d188f1631d Change Copyright year 2015 -> 2016 2016-01-29 21:46:02 +04:00
cigamit d2ab6ff1b3 properly render svg in reports output
properly parse $_REQUEST['image_format'] and properly force to 'png' for
reports.
2015-04-25 09:57:27 -05:00
cigamit abdc1e3d55 Merging 0.8.8d Updates with GitHub
Changes include:
- Convert some <br> to </li>
- Update ChangeLog per 0.8.8d release
- Fix Max Values on UCD/SNMP Memory Template
- Change Cacti Group Format to Modern Theme
- Fix Locking on Graphs
- Force Image format to PNG for Legacy Graph Image
- Correct form Logic on Settings to Fix Reverse Proxy's
- Shorten Uptime Display on Device Edit
- Force a Locale Setting for i18n on Graphs
- Fix Resizable Columns to resize only the current column
- Add DropIcon selectmenu Widget to modern theme
- Fix Issue where delete data source multi leaves orphan records
- Correct performance bug in Boost engine
- Optimize array_to_sql_or performance
- Correct and issue where pushing out data query objects to host cache
could leave orphan elements
- Add OID_REWRITE_PATTERN Feature on input
- Add VALUE/REGEXP Feature on output
- Optimize strip_quotes function to be more intellegent
- Escape shell arguments on Script Data Input types
- Allow Special Characters for LDAP passwords
- Correct LDAP class defect for anonymous binding
- Bypass php-snmp for now
- Correct rrdcleaner bytes units
- Fix loadavg_multi.pl to respect i18n
- Remove legacy row counters from snmpagent pages
2015-03-23 17:02:45 -05:00
cigamit 3913c7fa98 Graph View Cog works and more
Graph View Cog works
CSV Output from Cog View
Render SVG Correctly
Properly Save Cookie in all pages
2015-03-01 20:34:48 -06:00
Jimmy Conner 455d855894 1) Convert double quotes to single quotes
2) Remove references to $_GET replace with $_REQUEST
3) Remove some inline styles

git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/cacti/branches/0.8.8@7706 860744bd-22fc-0310-8c96-e9fe5004b5ca
2015-01-17 16:53:24 +00:00
Jimmy Conner 5bde3da972 1) Update Copyright Years Correct a few minor CY Issues
2) Allow Locking/UnLocking of Graphs
3) ToolTips
4) Correct Minor Issues with Login/Out/Permission associated with Theme JS
5) Upgrade jQuery which has Fixes for Major issue in Safari 7/8.1

git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/cacti/branches/0.8.8@7662 860744bd-22fc-0310-8c96-e9fe5004b5ca
2015-01-04 01:52:50 +00:00