82 Commits
Author SHA1 Message Date
Thomas Vincent 5da1a2d5e8 security: restrict graph input fields across handoffs (CVE-2024-31458) (#7669) 2026-08-30 10:56:16 -07:00
Thomas VincentandTheWitness 1f4461783d Parameterise graph and poller delete queries (#7264)
* security(graph): parameterise api_graph_remove_multi delete queries

The removal loop built an id CSV by raw concatenation (no intval) and repeated
the five deletes in a manual flush block. Replaced with array_chunk over
intval-ed ids and array_to_sql_or, which removes the duplicated block and the
unsanitised interpolation.

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

* security(poller): parameterise poller_output cleanup deletes

The three poller_output cleanup deletes interpolated a data-id list (a DB
GROUP_CONCAT and an accumulated array). Route them through array_to_sql_or on
intval-ed ids. The CREATE TABLE replication and poller-id lookups in this file
are left as a separate concern.

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

* Use safe numeric IN clauses for batch deletes

* fix: harden batched graph deletion inputs

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-07-20 16:00:48 -04:00
TheWitnessandCopilot Autofix powered by AI 8968fdf8bc Allow Users to Switch Devices for Data Query Graphs (#7247) (#7251)
* Allow Users to Switch Devices for Data Query Graphs (#7247)

* fix: Testing using 22.04 only

* fix: Remove matrix version in hopes that will fix it

* feature: #7246 - It should be possible to change device for Data Query Graph

* fix: Remove filter as it's done in separate section

* Potential fix for pull request finding

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

* Replace sizeof with cacti_sizeof for graph check

* chore: Update sinks

---------

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

* Fix syntax errors in graphs.php

* Fix formatting in for loop in graphs.php

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-06 12:41:02 -04: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
Jimmy Conner e539266a64 More Type Setting (#6170)
* Fix issues were a few function can return without a value

* More Type Setting

* Minor fix for check_auth_cookie
2025-03-10 11:40:30 -04:00
TheWitness 2c779273f9 Copyright Updates and PHP-CS-Fixer updates 2025-03-09 14:34:19 -04:00
TheWitness 633e365f0d QA: PSR Issue 2025-03-09 09:57:41 -04:00
TheWitness 97eaa15a7a QA: Issue discovered through Rector remediation 2025-03-09 09:57:22 -04:00
Jimmy ConnerandTheWitness 65ab16f5cf Start converting to newer PHP Syntax and Functions (#6103)
* Add Rector

* Add Rector

* Fix "Cashed" misspelling

Also harmonize the phrase with the one below it

* Fix implode error in db_table_create

Only relevant when multiple primary keys

* Fix auth issue, parentheses in the wrong location

Was causing too many arguments to be sent to cacti_sizeof which only take 1, instead of get_allowed_devices.

* Fix issue with session_var not properly using class variable

* Fix pass by reference error in get_allowed_devices

get_allowed_devices has a pass by reference on the "total_rows" field.  It is used in several places to pass the total_rows back to a counter.  Here though, we are passing a number directly to the function, which errors out with "Uncaught Error: get_allowed_devices(): Argument #4 ($total_rows) cannot be passed by reference".  So we will just place a dummy variable in front to catch the pass.

This wasn't caught before because the previous parentheses issue.

* Fix undefined variable "field_array" in html_filter

* Fix undefined function 'get_nfilter_filter_request_var'

* Fix undefined variable 'resizable'

I corrected the function parameter, as that was technically the incorrect spelling

* Fix invalid variable $user_id

* Fix undefined vars in spikekill class

* Fix copy and paste error

Oops

* Forgot to use the dummy variables

* Add missing $

Oops

* Start converting to newer PHP Syntax and Functions

* Test fixing the workflow by install composer

* Lets not valid the composer file right now
Seems we have a few things to fix it in

* Validate composer

* Lite formating changes

* lite formatting

* lite formatting

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

* lite format changes

---------

Co-authored-by: TheWitness <thewitness@cacti.net>
2025-02-23 15:14:54 -05:00
TheWitness 1aa72d24c9 QA: Update Copyright to 2024 2024-02-03 14:18:57 -05:00
Petr Macek 4e8350efcc fix wrong variable and few SQL queries (#5646) 2024-01-27 14:54:24 -05:00
TheWitness e1bdb612a0 Issue #4811 - Update for Device, Graph and Data Source Removal
These are untested, but should follow the rules.
2023-10-14 17:51:22 -04:00
TheWitness e191451529 Fixing #5459 - API Duplicate Graph Template too agressive
There is no option to not duplicate Graph Template Data Query association when duplicating a Graph Template
2023-08-19 20:20:12 -04:00
TheWitness 4a6fa95cb4 Fixing #5446 - Duplication Return Value
Duplication functions for Graph/Template and Data Source/Template do not return an id
2023-08-12 07:40:02 -04: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
TheWitness 4412722cb2 Fixing #4989 - Row Caching API
Cache Cacti 'Total Rows' by Hash to Improve Performance
2022-11-06 18:19:52 -05:00
TheWitness 3ed82d379f Fixing #4923 - Duplicate Template Issues
Graph template "duplicate" action does not working - 500 Internal Server Error
2022-09-11 14:01:49 -04:00
TheWitness 82b229db9e Updating Copyright to 2022. 2022-02-06 17:16:20 -05:00
TheWitness 3b9c2e789a Fixing Issue #4512 Graph API Issues
The Cacti API can not remove a Graph that has no Data Sources
2021-12-21 13:01:52 -05:00
TheWitness fac5e4fbd7 One more minor tweak to #4126
How can an auto_increment be 0 you ask?  I don't know.
2021-02-15 12:31:47 -05:00
TheWitness 75c74262cd Light modification around #4126
Let's only run that query when we need to.
2021-02-15 09:04:04 -05:00
TheWitness 28b46fe70a Fixing Issue #4126
It is possible to delete all templates by deleting a damaged graph with a local_graph_id of 0
2021-02-15 08:34:19 -05:00
TheWitness df54a4a3f3 Updating copright years 2021-01-01 20:28:58 -05:00
TheWitness 52bb6ffda7 Remove all remaining instances to "sizeof(" or "count(" in code
* Some insances in the vendor directory have not been handled to maintain pedigree.
2020-10-21 08:27:42 -04:00
netniV 4fa9a68fb3 Update copyright to 2020 2020-01-12 12:19:49 +00:00
Jimmy Conner 977882b327 Fix typo in api_graph 2019-07-01 13:30:32 -05:00
cigamit a4cc19650b Resolving Issue #2784
When removing a device with graphs but no data sources , errors are generated
2019-06-30 13:14:23 -05:00
cigamit 6e5549b368 Resolving Issue #2499
Data Source reapply names does not update name from data query or template
2019-03-12 22:21:19 -05:00
cigamit bbae4e3d55 More error checking for issue #2372
As I can not find an issue here except potentially for a to the remove
function with an empty array.  So, I will add those checks now.
2019-02-09 08:05:08 -06:00
cigamit 1f8f8898dc Resolving Issue #2365 and multipl Aggregate issues
- Graphs included in aggregate that are removed are not managed properly
- The associate and disassociate functions were not following proper API
rules, they were leveraging request variables and redirecting using
header().
- Aggregate was not properly handling nth percentile.  It's now handling
that correctly, though still has an issue with the actual value.  This
will be fixed separately.
- Adding new convert to stacked line options for graph readability
- Totalling when using Print showing legend items was also showing graph
items, which is not correct.
- When totalling, Aggregate was attempting to show a blank line, but due
to an SQL format error, no blank line was displayed.
- Typo in one aggregate function was not properly handling the GPRINT
MIN graph item type
2019-01-31 07:39:09 -06:00
netniV b8c579b129 Update copyright notices for 2019 2019-01-25 08:06:11 +00:00
netniV d43a4cdd70 Resolving issue #2127 2018-10-29 14:29:45 +00:00
cigamit 230d58f861 Increase speed of re-apply suggested graph name 2018-10-07 16:59:30 -05:00
cigamit 0b991958fd Resolving Issue #1982
Certain hooks should occur within api functions rather than UI functions
2018-09-28 04:49:59 -05:00
Mark Brugnoli-Vinten 1ca32862a9 Resolving issue #1920 (#1922)
* Resolving issue #1920

* Minor QA issue
2018-09-14 20:59:52 -05:00
cigamit 4870172951 Resolving Issue #1671
Duplicate Graph Template does not duplicate Data Query Graph Template
Mappings
2018-08-19 18:37:08 -05:00
cigamit 62615311b5 Merge remote-tracking branch 'refs/remotes/origin/develop' into feature/1.2.x
# Conflicts:
#	docs/CHANGELOG
2018-01-06 14:08:07 -06:00
Tony Roman 519b35f5cd Update copyright to 2018 2018-01-06 09:10:15 -05:00
cigamit 99d19d5312 Correct whitespace and formatting issues
Whitespace and formatting in lib
2017-11-19 14:35:17 -06:00
Tony Roman 6d1b0a9a76 Merge branch 'develop' into feature/1.2.x
Conflicts:
	aggregate_graphs.php
	auth_login.php
	automation_templates.php
	cli/add_tree.php
	graph_templates_items.php
	lib/api_automation.php
	lib/api_tree.php
	lib/auth.php
	lib/html_form_template.php
2017-11-18 09:44:33 -05:00
Patrick 4bc2f4c0bc Various updates (#1073)
* Updated Dutch translations
- Fixed i18n

* Defined fields in queries

* Fixed changelog

* Updated Dutch translations

* Various fixes

All committed files:
- true|false to lowercase

add_perms.php:
- displayGroups() was undefined

add_tree.php:
- duplicate case for '--quiet'

repair_templates.php:
- correction function call to diaplay_version()

gettext.php:
- PHP EOF unneeded

* Fixed warnings in graph_view

* Updated Dutch translations
- Updated Dutch translations with latest cacti.pot file

* Updated Dutch translations
- Fixed conflicts in translations

* Various fixes
- Changed array access identifiers
- Fixed some code layout changes
- Fixed one i18n entry in api_automation.php

* Updated changelog

* Layout changes (tab instead of spaces)

* Layout changes (tab instead of spaces)

* Various fixes
- Changed array access identifiers
- Fixed some code layout changes

* Some fixes for better querying

* Layout change only

* Updated Dutch translations

* Updated changelog

* Updated changelog

* Fixed upgrade script 1_1_28.zip

* Few final fixes after CR or changes

* Updated Dutch translations
2017-11-11 05:45:12 -06:00
Tony Roman 6c73dd6105 Merge branch 'develop' into feature/1.2.x
Conflicts:
	cli/add_tree.php
	docs/CHANGELOG
2017-10-16 11:36:51 -04: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
cigamit e7a6a783fa issue: Move Graph removal function to Graph API 2017-09-01 10:09:53 -05:00
Tony Roman 8a179d7d7f Fix up to move if elseif else blocks to PSR 2017-05-07 19:57:36 -04:00
cigamit ab746b0e38 Add new field for graph templates to form actions
Increase the minimum import level for new templates, insure that new
templates imported with this column are saved properly, include
duplicate graph functionality, change field to a char(2)
2017-04-28 04:45:13 -05:00
Patrick 623611cd16 PHP7.2 changes:
- Replaced deprecated each() for foreach()
- Removed unnecessary reset() calls used for resetting pointers of an array before iterating by a foreach() loop
2017-04-18 14:40:29 +02:00
patrick cc1cc7eab2 PHP7.2 changes:
- Replaced deprecated each() for foreach()
- Removed reset() calls used for each() loops
2017-04-15 18:00:13 +02:00