93 Commits
Author SHA1 Message Date
TheWitnessandLarry Adams 75d816a335 security: consolidate GHSA batch 11 fixes for develop (fq9x, hh7r, v99q, f5f5) (#8165)
* security: consolidate GHSA batch 11 fixes for develop (fq9x, hh7r, v99q, f5f5)

Mirrors the 1.2.x batch-11 security consolidation. Items already fixed on the
develop tip are credited on their advisories and omitted here:
- GHSA-54hx-hxc4-jq7j: TICK/SHIFT values already pass through strip_alpha().
- GHSA-hh7r CSV portion: already guarded via cacti_csv_cell(); only the
  Content-Disposition filename needed sanitizing (included below).
- GHSA-mx5c: REST scaffold already deny-by-default (404 unless api_enabled),
  enforced by tests/Unit/ApiDenyByDefaultTest.php.
- GHSA-rjvj/pjq5/fmhq/mfw8: already addressed on develop.

Fixes applied here:
- GHSA-fq9x-x3vf-3vf2 (High): add substitute_script_path() single-pass token
  substitution and refactor get_full_script_path()/get_full_test_script_path()
  to use a pre-escaped value map, closing the second-order re-substitution OS
  command injection.
- GHSA-hh7r-464j-rf39: sanitize the Content-Disposition filename in graph_xport.php.
- GHSA-v99q-57w7-mpmg: escape the page title rendered in the HTML <title>.
- GHSA-f5f5-h85v-6m3h: render user admin tooltip content as escaped text.

* security: add batch-11 consolidation regression tests for develop

Addresses PR #8165 review feedback by adding regression coverage for all four fixed sinks:

- GHSA-fq9x: behavioral single-pass proof that substitute_script_path() does not re-substitute a field value containing another field token, plus source guards that both path builders use the helper.

- GHSA-hh7r: Content-Disposition filename strips CR/LF/quote/backslash.

- GHSA-v99q: the HTML <title> is html_escape()'d.

- GHSA-f5f5: both the user_admin.php and user_group_admin.php tooltips render data-tooltip as escaped text.

* style: apply php-cs-fixer formatting to substitute_script_path (CI coding standards)

* docs: require composer run-script php-cs-fixit before creating any pull request

* docs: require PHPStan (level 8, satisfies Level 6 floor) to pass before creating any pull request

---------

Co-authored-by: Larry Adams <TheWitness@users.noreply.github.com>
2026-10-03 14:20:33 -04:00
Thomas VincentandTheWitness bdba47826b fix: align percentile rank with observed export samples (#7322)
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-07-20 15:38:29 -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
cd7d086384 fix: unify HTTPS detection with cacti_is_https() helper (#6715)
* cleanup: remove unreachable defensive error logs in aggregate graph item validation

* fix: unify HTTPS detection with cacti_is_https() helper

Replace 8 inline $_SERVER['HTTPS'] checks across 4 files with a
single cacti_is_https() helper in lib/functions.php. Handles edge
cases: 'off' (case-insensitive), '0', empty string, and unset.

Add 10 Pest tests covering all HTTPS detection edge cases.

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

* chore: remove unintended api_aggregate delta from PR scope

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

* docs: add header comment to CactiIsHttpsTest explaining consolidation scope

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-06 09:28:44 -05:00
f0b5baad90 fix: xport empty data handling + add Pest unit tests for sanitization and validation (#6683)
* cleanup: remove unreachable defensive error logs in aggregate graph item validation

* fix: log and surface error when rrdtool xport returns empty data

Add error logging in rrdtool_function_xport() when xport returns
no data. Update graph_xport.php to handle empty results gracefully.

Add Pest unit and integration tests for graph xport error handling,
string functions, serialization security, and HTML escaping.

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

* fix: escape shell args in xport integration tests

Use escapeshellarg() for all interpolated paths in rrdtool commands
to prevent breakage on systems with spaces in temp directory paths.

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>

* chore: narrow xport PR to xport-focused changes

Drop unrelated shared test and harness updates so this branch only carries xport handling and its focused unit coverage.

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 20:07:51 -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 e679b6209a fix 6499 - Illegal string offset 'meta' (#6502) 2026-01-03 10:28:47 -05:00
TheWitness ac0c1c5c45 Switch from include to require 2025-04-03 14:37:02 -04:00
TheWitness 2c779273f9 Copyright Updates and PHP-CS-Fixer updates 2025-03-09 14:34:19 -04:00
TheWitness 89ac356f5c QA: Apply width
* This may not be the end as it's not a flex layout
2024-12-30 17:08:29 -05:00
TheWitness ab5eb52694 QA: More clear wording 2024-12-30 17:04:00 -05:00
TheWitness bae6409ffe QA: Light Redesign of graph_xport.php 2024-12-30 16:59:29 -05:00
TheWitness 1aa72d24c9 QA: Update Copyright to 2024 2024-02-03 14:18:57 -05:00
Petr Macek 2dcd58b376 fix CSV export - missing first row and wrong start time (#5586) 2023-11-19 16:34:08 -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 7a62f934f6 Fixing Issue #4884 - Graph XPort Issues
Graph XPort Issues with PHP 8.x
2022-08-09 18:57:21 -04:00
TheWitness 82b229db9e Updating Copyright to 2022. 2022-02-06 17:16:20 -05:00
netniV 9b9754e29b When viewing graph data, non-numeric values may appear (#4461)
Closes #4461
2021-11-14 12:31:44 +00:00
TheWitness df54a4a3f3 Updating copright years 2021-01-01 20:28:58 -05:00
TheWitness 11807096d2 Fixing Issue #3920
CSV Export with Summation Rows
2020-11-21 16:02:09 -05:00
TheWitness 3797386fda Fixing Issue #3543
CSV Export output readability issues using UTF8 characters
2020-06-07 09:39:17 -04:00
TheWitness 6fa429c312 Additional Fixing of #3427 after Feedback
When export a csv with Chinese word garbled
2020-04-26 13:35:46 -04:00
TheWitness 5b9253846e Fixing Issue #3427
When export a csv with Chinese word garbled
2020-04-08 23:00:36 -04:00
TheWitness d65f40d2bf Abstract Cacti session handler 2020-03-29 19:08:29 -04:00
FrontierLiu 747c77ef59 Update graph_xport.php (#3356) 2020-03-17 19:18:51 -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
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 c7cf4a26e4 Resolving Issue #2964 for CSV output
This should be the last permission issue around data export issues.
2019-09-23 19:29:26 -05:00
netniV 308292e2d7 Update copyright notices for 2019 2019-01-25 08:05:00 +00:00
cigamit cef4bd8671 -issue: align attribute is deprecated, use class instead 2018-11-10 11:35:55 -06:00
cigamit 41923e8c30 Minor sort css updates 2018-06-12 08:01:43 -05:00
cigamit f85937cf1f Resolving Issue #1185
Second shot.  Working late has it's downsides.
2018-01-11 23:43:12 -06:00
cigamit d8758778f0 Resolving Issue #1185
Layout issue with Graphs having large number of data columns
2018-01-11 14:18:36 -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
Patrick c3419aa36e Various fixes && Updated Translations (#1032)
Good catch on the bug fixes too.  Hard to spot.
_______________________________________________________

* 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

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

* Updated Dutch translations
- Fixed conflicts in translations
2017-10-15 07:27:25 -05:00
Patrick 5669472765 Various updates (#1019)
* Updated Dutch translations
- Fixed i18n

* Defined fields in queries

* Fixed changelog

* Updated Dutch translations
2017-10-11 17:59:30 -05:00
cigamit 229346f929 Missed one decode statement. 2017-09-04 09:43:01 -05:00
cigamit 83e90d8b3c More attempts at issue #952
Don't perform the escape for the browser unless you have to.
2017-09-04 09:41:45 -05:00
cigamit 41fa476723 Another crack at issue #952
CSV export does not handle chinese title cache and vertical labels
2017-09-04 08:45:29 -05:00
cigamit bd811000bd Resolving Issue #952
CSV Export does not render in Chinese properly
2017-09-03 11:35:16 -05:00
Tony Roman 8a179d7d7f Fix up to move if elseif else blocks to PSR 2017-05-07 19:57:36 -04:00
Tony Roman 35a5988f41 Update source code files copyright to new year 2017-01-01 13:45:29 -05:00
cigamit ae0bb050b0 Fix issues with clicking on graph view properties before graph is first polled 2016-10-21 01:55:06 -05:00
cigamit b586e996b0 implement number_format_i18n() in core 2016-07-10 10:12:05 -05:00
cigamit 9d7854d6c3 csv download fixes 2016-06-01 09:33:59 -05:00