Skip to content

Commit 3e4bf13

Browse files
fix: document uniqueID constraint and remove false-confidence SQL denylist
- Add comment documenting tinyint constraint on uniqueID (1-127 range) - Replace bypassable SQL denylist with trust-boundary documentation Signed-off-by: Thomas Vincent <[email protected]>
1 parent cfb49a3 commit 3e4bf13

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

functions.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,10 @@ function syslog_build_match_filter($type, $value, $column = '') {
16301630
$params[] = '%' . $value;
16311631
break;
16321632
case 'sql':
1633-
/* Admin-configured raw SQL WHERE clause from syslog_remove table.
1634-
Reject values containing statements that should never appear in a filter. */
1635-
if (preg_match('/\b(DROP|ALTER|TRUNCATE|CREATE|GRANT|REVOKE|INTO\s+OUTFILE|INTO\s+DUMPFILE|LOAD_FILE)\b/i', $value)) {
1636-
cacti_log('SYSLOG ERROR: Rejected dangerous SQL pattern in removal rule', false, 'SYSTEM');
1637-
break;
1638-
}
1633+
/* The 'sql' match type passes admin-configured expressions directly into
1634+
* the WHERE clause. This is an intentional trust boundary: only Cacti
1635+
* administrators with console access can configure removal/alert rules.
1636+
* No programmatic sanitization can safely parse arbitrary SQL fragments. */
16391637
$sql = '(' . $value . ')';
16401638
break;
16411639
}
@@ -1700,6 +1698,10 @@ function syslog_preprocess_incoming_records() {
17001698
$uniqueID = 0;
17011699
$incoming = 0;
17021700

1701+
/* uniqueID is constrained to tinyint range (1-127) by the status column.
1702+
* Collision probability rises with concurrent pollers; the retry loop
1703+
* (up to 256 attempts) mitigates but does not eliminate this risk.
1704+
* A future schema change to widen status to int would allow a larger space. */
17031705
try {
17041706
$attempts = 0;
17051707
while (1) {

0 commit comments

Comments
 (0)