47 Commits
Author SHA1 Message Date
Thomas Vincent 08d0f94f24 Fix develop client behavior, popup isolation and PHP method visibility (#8292)
* fix(core): correct client state and declare public method contracts

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

* fix(security): isolate Midwinter external homepage popup

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

* fix(client): isolate menu state and simplify validated JavaScript guards

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

* test(auth): use certificate expiry truth in rendering assertions

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

* refactor(js): remove unused local storage while retaining initializer calls

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

* fix(js): encode inline translated values through the shared JSON boundary

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

* style(js): wrap encoded translation literals without changing messages

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

* fix(client): remove unused checkbox reads from graph resizing

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

* refactor(client): declare repeated function locals once

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

* test(ui): run column width regression in browser CI

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-11 21:15:39 -04:00
Abdul MohammadandTheWitness 7cb994d36c fix(installer): recover from expired CSRF tokens (#7392)
* fix(installer): recover from expired CSRF tokens

Return a replacement token for expired installer AJAX requests, retry the failed action once, and roll tokens forward after successful responses.

Fixes #7343

Signed-off-by: Abdul Mohammad <abdul.mohammad9087@gmail.com>

* test(installer): exercise CSRF recovery round trip

Signed-off-by: Abdul Mohammad <abdul.mohammad9087@gmail.com>

---------

Signed-off-by: Abdul Mohammad <abdul.mohammad9087@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-08-05 10:14:16 -04:00
b2bf39b8dc fix(sqli): sanitize sort_column and enforce sort_direction in ORDER BY clauses (#7162)
* fix: correct grammar and possessive errors in English source strings (batch 2) (#1)

* fix: correct grammar and possessive errors in English source strings (batch 2)

Seven errors found via cacti.pot audit:

- automation_networks.php: "senders name" → "sender\'s name" (line 839)
- automation_networks.php: "senders Email" → "sender\'s Email" (line 848)
- automation_templates.php: "devices sysDescr" → "device\'s sysDescr" (line 1060)
- automation_templates.php: "devices sysName" → "device\'s sysName" (line 1067)
- automation_templates.php: "devices sysOid" → "device\'s sysOid" (line 1074)
- data_templates.php: garbled "it either it value...critical data Data Query" →
  "its value...Data Query" (line 903)
- package_repos.php: "Package Repositorites" → "Package Repositories" (line 436)

All changes are to UI description strings inside __() / __esc() calls.
cacti.pot should be regenerated via build_gettext.sh after merge.

* fix: correct grammar and possessive errors in English source strings (batch 2)

Seven errors found via cacti.pot audit:

- automation_networks.php: "senders name" → "sender\'s name" (line 839)
- automation_networks.php: "senders Email" → "sender\'s Email" (line 848)
- automation_templates.php: "devices sysDescr" → "device\'s sysDescr" (line 1060)
- automation_templates.php: "devices sysName" → "device\'s sysName" (line 1067)
- automation_templates.php: "devices sysOid" → "device\'s sysOid" (line 1074)
- data_templates.php: garbled string → "its value...Data Query" (line 903)
- package_repos.php: "Package Repositorites" → "Package Repositories" (line 436)

All changes are to UI description strings inside __() / __esc() calls.
cacti.pot should be regenerated via build_gettext.sh after merge.

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

---------

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

* ci: add dependabot config with npm and github-actions

* ci: add CodeQL (JS/TS, excludes PHP) with workflow_dispatch

* ci: update CodeQL for javascript-typescript, python

* fix(ci): use specific runner labels, fix codeql concurrency

* Improve IPv6 support in RRDtool proxy and ping utilities (#2)

* Improve IPv6 support in RRDtool proxy and ping utilities

- Fix RRDtool proxy to dynamically detect IPv6 addresses and use
  AF_INET6 sockets instead of hardcoded AF_INET (IPv4-only), enabling
  connections to IPv6 RRDtool proxy servers including backup servers
- Strip brackets from IPv6 addresses before passing to socket_connect
- Properly close failed sockets before creating new ones for failover
- Replace fragile str_contains(':') IPv6 detection in ping with
  filter_var(FILTER_FLAG_IPV6) for more robust address validation

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Fix JS code quality: implicit globals, deprecated APIs, loose equality

- Add var declarations to prevent implicit globals in install.js
  (element, enabled, button, buttonCheck)
- Remove console.log debug output left in production (install.js)
- Replace deprecated jQuery .unbind() with .off() (layout.js)
- Fix "depreciated" typo to "deprecated" in deprecation warnings
- Convert == / != to === / !== for null, boolean, string, typeof,
  and numeric comparisons across install.js and realtime.js

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Replace deprecated jQuery shorthand event methods in layout.js

Replace .click(), .keyup(), .keydown(), .mousedown(), .mouseenter(),
.mouseleave(), .submit(), .resize() with .on() equivalents. Replace
.focus(), .change() trigger calls with .trigger(). These shorthands
were deprecated in jQuery 3.5.

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Replace deprecated jQuery methods in realtime.js

Replace .bind() with .on() and .change() trigger calls with
.trigger('change'). .bind() was deprecated in jQuery 3.0 and
shorthand triggers in jQuery 3.5.

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Replace deprecated jQuery methods in install.js and fix ===/!== errors

Replace .click(), .change(), .focus() with .on()/.trigger() equivalents.
Also fix !=== and ==== operators that were incorrectly introduced by a
prior replace-all of == to === within existing !== and === expressions.

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Restore == null where needed to catch both null and undefined

In JavaScript, == null matches both null and undefined, which is an
intentional idiom. The prior === null conversion broke cases where
values come from jQuery .val(), .data(), $.urlParam(), or object
property access that may return undefined rather than null. Revert
those specific cases while keeping === null where variables are
explicitly initialized to null.

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Replace deprecated jQuery methods in all theme main.js files

Replace .unbind().click() with .off('click').on('click'), convert
.hover() to .on('mouseenter').on('mouseleave'), replace .change(),
.scroll(), .click() shorthands with .on() equivalents, and .blur()
with .trigger('blur') across all 10 theme files.

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Convert string concatenation to template literals

Replace 'str' + var + 'str' patterns with ES6 template literals
in realtime.js and install.js. Improves readability especially for
URL construction and HTML building. Also replace $.parseJSON() with
native JSON.parse() in realtime.js.

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

* Convert var to const for single-assignment variables

Replace var with const where the variable is assigned once and never
reassigned within its scope, in install.js and realtime.js. Keeps var
for variables that are conditionally reassigned (e.g. size, url).

https://claude.ai/code/session_01SbuDigvAkYvPKvdcougsdo

---------

Co-authored-by: Claude <noreply@anthropic.com>

* fix(sqli): sanitize sort_column and enforce sort_direction in ORDER BY clauses

Closes GHSA-q9xg-p762-9jm3 and GHSA-72vr-jr4v-55vf.

- Add sanitize_sql_column() to lib/functions.php stripping all chars
  outside [a-zA-Z0-9_().] from user-supplied column names
- Apply sanitize_sql_column() at every ORDER BY concatenation in
  api_automation.php and html_reports.php
- Enforce direction to literal ASC/DESC in html_reports.php,
  api_automation.php, and html_utility.php (update_order_string,
  get_order_string)
- Add tests/Unit/SafeSortTest.php with 22 stub-based regression tests

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

* fix(docs): move sanitize_sql_column above sanitize_search_string docblock

The sanitize_search_string docblock was orphaned after sanitize_sql_column
was inserted between it and the function body. Reorder so each function
follows its own docblock directly.

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

* fix(sqli): escape apostrophes in automation_templates and harden sort_direction in display_matching_hosts

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

* fix(sqli): restore allowlist guard, sanitize session keys, add sanitize_sql_column default

Restore the preg_match allowlist guard in get_order_string() that was
removed by the PR, re-opening the ORDER BY injection surface. When the
request var is empty after sanitization, return '' rather than building
a malformed ORDER BY clause.

Sanitize sort_column before storing as SESSION array key in
update_order_string() and add read-time guard in the inplace loop that
rebuilds ORDER BY from stored keys.

Add $default parameter to sanitize_sql_column() so callers get a safe
fallback instead of an empty string that produces 'ORDER BY  ASC'.

Fix inconsistent INET_ATON substitution in display_matching_hosts().

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

* Improve sanitize_sql_column function

Fix regex to sanitize SQL column names properly.

* Potential fix for pull request finding

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

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-24 16:54:42 -04:00
TheWitness 27919c50d7 Updating Copyrights to 2026 (#6578) 2026-01-28 16:11:10 -05:00
Browniebraun 1627c7a150 Font Awesome Icons to Tabler Icons migration 2025-12-16 20:27:05 +01:00
Petr Macek 62b512ca59 feature #6228 - add admin's email to installer, enable Notify admin (#6274)
* feature #6228 - add admin's email to installer and enable Notify primary admin of issues

* update
2025-06-25 15:32:00 -04:00
TheWitness 2c779273f9 Copyright Updates and PHP-CS-Fixer updates 2025-03-09 14:34:19 -04:00
Linegod 048f2abcc8 typos 2025-02-23 00:13:55 -06:00
Petr Macek b17d3f3c66 installer - Notices and recommendations (#6069)
* change installer page to Notices and recommendations

* update
2025-01-19 15:18:54 -05:00
Browniebraun d88d3acd30 reverting FontAwesome till better solution has been identified. 2025-01-15 23:04:14 +01:00
Browniebraun 5be7d7f18b Migrating icons from FontAwesome to Tabler 2025-01-05 20:58:36 +01:00
TheWitness 467c758c4f Fix: #5837 - Don't allow Remote install to older main Cacti 2024-12-22 11:16:14 -05:00
TheWitness e165036931 Fixing #5804 - Remove Classic Theme
* Remove Classic theme from Cacti
2024-10-13 19:03:21 -04:00
TheWitness 1aa72d24c9 QA: Update Copyright to 2024 2024-02-03 14:18:57 -05:00
TheWitness be9a3fb0fd QA: Properly reselect template rows
* This happens when you go forward, and then backward to the template page.
2023-11-19 16:35:54 -05:00
Jing Chen 1626fdd7cf Upgrade flag-icon-css v3.1.0 to flag-icons v6.11.1 (#5497) 2023-09-27 20:56:42 -04:00
TheWitness e89acf4e3f QA: When installing templates, the rows should be selectable
This has been broken for a while, and I just decided to spend some time fixing it.
2023-08-19 20:20:12 -04:00
Mark Brugnoli-Vinten 32ba2f19f4 Update copyright year for 2023 2023-01-03 20:34:26 +00:00
Mark Brugnoli-Vinten b6ff8d9360 Update more copyrights 2022-12-01 02:27:49 +00:00
Jimmy Conner 97448fee49 Installer: Check PHP INI values to determine if the user must restart
Resolves #4832 and #4833
We can play with this and change up the text, etc.. as needed.
2022-06-17 14:38:12 -05:00
TheWitness 436dd06f1b Handle installer problem and prepare for 1.2.15 release 2020-10-11 15:18:41 -04:00
cigamit e1fbb7b1db Resolving Issue #3218
* This change will allow both cli and web installs to function again
* Also introduces a new prompt to inform the user about whitelist protection, but does not enable it.
2020-02-02 09:25:57 -06:00
cigamit 75156ac291 Additional testing for issue #3055 2019-11-29 11:13:48 -06:00
cigamit 7371253292 Resolving Issue #3055
Installer database connection checks for remote pollers
2019-11-29 10:49:37 -06:00
netniV 81b4486971 Resolving issue #2047 2018-10-11 13:11:24 +00:00
netniV 2b951d9a26 Resolving issue #2048 - IE Sucks 2018-10-11 12:07:08 +00:00
Mark Brugnoli-Vinten e09759f918 Resolving issue #2024 (#2027) 2018-10-07 03:43:37 -05:00
Mark Brugnoli-Vinten 8f37075039 More QA fixes for the installer (#1965) 2018-09-23 17:57:35 -05:00
Mark Brugnoli-Vinten 1fa7718f54 QA Updates for 2018-09-21 (#1957)
* Resolving issue #1955

* Resolving issue #1956
2018-09-21 07:06:47 -04:00
Mark Brugnoli-Vinten e48f788d92 Resolving issue #1870 (#1917) 2018-09-12 20:01:18 -05:00
Mark Brugnoli-Vinten c4d6a6b5b9 Some QA fixes on latest Installer (#1913)
* Some QA fixes on latest Installer

* Correct Typo in CsrfMagic usage
2018-09-10 17:56:41 -05:00
Mark Brugnoli-Vinten 439668519a Add CLI-based installer, fix 100+ table issue (#1912) 2018-09-10 00:39:40 -05:00
Mark Brugnoli-Vinten d3821d8f54 Installer Updates (#1890)
* Resolving Issue #1850

* Further updates, correct i18n language selection

* Another round of updates for #1850
2018-09-04 07:07:04 -05:00
Mark Brugnoli-Vinten 26d35661e5 Feature #1627 - Allow setting SNMP options during install (#1827)
* Add SNMP options during installer profile defaults, use draw_form()

* Installer now has field arrays to determine fields to parse

* Install SNMP option set item and make device defaults too
2018-08-12 19:32:52 -05:00
Mark Brugnoli-Vinten 6e1b8431b7 Fixes for Issues 1781, 1782 and 1784 (#1785)
* Fixes for Issues 1781, 1782 and 1784

This patch corrects the following issues:

- #1782 During Install, changing the Theme from Modern to another theme has no
        effect
- #1784 During Install, changing the Language from one to another has no
        effect
- #1781 Installer does not warn when mysql optimizations not set

As part of #1781's fixes, a new warning icon is displayed instead of a thumbs
up or down.  Additionally, recommendations have been revamped so that the ones
which are optionally (and some even state can be ignored) are now optional!

Also, introduced the correct calculation for innodb instances by taking the
buffer size during a previous recommendation and calculating from that.  If
the buffer size is never found or the calcuation finds less than 1 instances
are recommended, a minimum of 1 is set.

The main reason for #1782 and #1784's issues were caused by renaming index.php
to install.php as part of the recent security update (see PR #1747).  Updated
the javascript to use the correct install.php and then removed some extra data
that was being returned outside of StepData unnecessarily.

* Further fixes

This update corrects a number of issues with the database upgrading code, adds
the 'debug' plugin from cigamit, improves database functions to be more
consistent with errors across all functions and various installer based fixes
for the display and update of database upgrades.

It also brings a more visual response to the cli/upgrade_database.php so that
end users are not left wondering if something is happening.  Also, reviewed
all upgrade scripts to ensure that an upgrade from 0.8.8 through to 1.2.0 is
possible even if a previous database upgrade have been done.

* Fix QA issue with 'path_cactilog'

Due to some code reshuffle and testing, found that the above setting was being
read via read_config_option() before there was a database open so no path was
ever detected unless the force option was used.
2018-08-05 10:43:01 -05:00
cigamit 336171c1a9 Add Cron Interval to installer correct i18n issues
This will allow cron interval to be specified in the installer in order
to reduce the likihood off issue due to incorrect settings.
2018-07-28 21:27:58 -05:00
Mark Brugnoli-Vinten 68d0b56049 Fix for issue #1738 (#1740)
* Fix for issue #1739

* Update CHANGELOG
2018-07-23 08:25:46 -04:00
Mark Brugnoli-Vinten da8b5169b7 Feature #1588: Check that PHP can run a test file (#1722)
* Feature #1588: Check that PHP can run a test file

* Feature #1628 - Allow the User to define a initial Network Discovery during Setup

* Fix QA issue with PHP 5.4

* Replace \n with PHP_EOL

* Minor changes to tabs vs. space and PHP_EOL

Will have to update packages based upon this too.

* Another minor pull where PHP_EOL was removed
2018-07-21 12:12:25 -04:00
Mark Brugnoli-Vinten 94240ac390 Fixes for issues #1589 and #1690 (#1706)
* Fixes for issues #1589 and 1690

This commit applies fixes for #1589 (Checking temporary folder is writable) and #1690 (Report a warning if collation is not utf8mb4_unicode_ci)

* Remove debug code
2018-07-14 11:23:23 -05:00
Mark Brugnoli-Vinten 5d075f62fc Feature #1034: Ensure tables are UTF8 (#1635)
* Feature #1034: Ensure tables are UTF8

* Make PHP 5.4 happy
2018-05-12 15:35:50 -05:00
Mark Brugnoli-Vinten 95a9688ddf Feature #1623 - Installer: Allow Language Selection on Welcome Screen (#1625)
* Feature #1623 - Installer: Allow Language Selection on Welcome Screen

* Add missing flag-icon-css library
2018-05-09 21:01:40 -05:00
cigamit e772309229 Spreed up progress bar for faster systems 2018-05-08 20:35:12 -05:00
cigamit 6786f6809d Correct Three Issues
Syntax error in install.js
Data Source Profile Updates
Syntax error in installer.php
2018-05-08 17:37:32 -05:00
Mark Brugnoli-Vinten 4b9bdbe120 Installer QA fixes (#1619) 2018-05-08 17:13:29 -05:00
cigamit f9ef8ae1fb Installer Changes and QA
1) Correct some US vs. UK English defaults
2) Make theme selection active on all installer pages
3) Some jQueryUI fixes
4) Change Copyright to use constant
5) Javascript cleanup
6) Remote poller button visibility
7) Header Show/Hide Simplication
8) Double to single quotes
2018-05-06 20:18:32 -05:00
Mark Brugnoli-Vinten c74e27fb5b Feature #1584 - Theme selection should be on first screen (#1592)
* Add theme default and fix false error report #1584

* Switch sides for theme and acceptance

* Remove debug code
2018-04-30 05:51:22 -05:00
Mark Brugnoli-Vinten ddddaec6ae Ajax Installer (#1586)
* Beginning of Install via AJAX calls

* Added steps 3 & 4 to the installer system

* Add background update procedure.  Still needs more upgrade code adding, like upgrading the DB

* Minor fixup during QA

* Remove debug code from lib/functions.php

* More QA fixes, add slight delay to index.php initialisation to see javascript warning (should be removed)

* beta3 - added data source profiles

* beta4 - fix some issues found in QA

* beta5 - upgrade databsae routines added, error results screen styled

* Add some colour to the thumb icons

* QA fix to remove unneeded option

* Fix for PHP 5.4 travis failure
2018-04-29 10:05:32 -05:00