Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
eb77d25
code review sweep
bmfmancini Jul 24, 2026
1dc34b2
Update audit.php
bmfmancini Jul 24, 2026
98c88f7
additional sweep
bmfmancini Jul 24, 2026
4660680
rename some columns to be more specific
bmfmancini Jul 24, 2026
6d3afb2
Support json for external logging
bmfmancini Jul 24, 2026
ab887ac
fix json formatting
bmfmancini Jul 24, 2026
6e27cc3
expand auditing coverage
bmfmancini Jul 24, 2026
d3fb6c5
remove file
bmfmancini Jul 24, 2026
ff37c63
update php version
bmfmancini Jul 24, 2026
bb8b4da
fix failing workflow
bmfmancini Jul 24, 2026
0baa006
Merge upstream/develop into feature/compliance-event-capture
bmfmancini Jul 24, 2026
6b697af
Seperate puge log permissions
bmfmancini Jul 25, 2026
77ddc4f
rename permissions
bmfmancini Jul 25, 2026
aba1684
clean up name
bmfmancini Jul 25, 2026
3b7b330
group permissions for audit
bmfmancini Jul 25, 2026
0c78634
simply permissions
bmfmancini Jul 25, 2026
3f243db
Add more reliable way to capture success/fail
bmfmancini Jul 25, 2026
7c3689d
fix version
bmfmancini Jul 25, 2026
faeb08f
Merge remote-tracking branch 'upstream/develop' into feature/complian…
bmfmancini Jul 25, 2026
6ce4a08
Add secure remote Syslog audit delivery
bmfmancini Jul 25, 2026
0bee6bf
Fix Syslog warning leakage in poller
bmfmancini Jul 25, 2026
973adce
Delete openspec/changes/add-evidence-integrity-governance directory
bmfmancini Jul 25, 2026
bc08d10
Include audit evidence in CEF records
bmfmancini Jul 25, 2026
7afbf6d
Merge remote-tracking branch 'upstream/develop' into feature/evidence…
bmfmancini Jul 25, 2026
42ab811
Add PHP code quality tooling (PSR-12, PHPStan, PHP-CS-Fixer)
bmfmancini Jul 25, 2026
b7b3d42
Apply PHP-CS-Fixer auto-formatting (Cacti ruleset)
bmfmancini Jul 25, 2026
f99106f
Add declare(strict_types=1) and PHP 8.1+ syntax test
bmfmancini Jul 25, 2026
d734b02
Remove strict_types (deferred until Cacti 1.3)
bmfmancini Jul 25, 2026
0d9f180
Add native PHP 8.1+ type annotations to all plugin functions
bmfmancini Jul 25, 2026
346b2fb
Fix PHPStan level 8 errors in plugin source files
bmfmancini Jul 25, 2026
10e2e44
Add code-quality CI workflow
bmfmancini Jul 25, 2026
0f6d08e
Drop PHP 8.1 support, pin symfony to ^7.0
bmfmancini Jul 25, 2026
be7faeb
Restore PHP 8.1 support
bmfmancini Jul 25, 2026
551d773
Merge upstream develop into psrstan
bmfmancini Jul 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.php]
indent_style = tab
indent_size = 4

[*.{js,sh}]
indent_style = tab
indent_size = 4

[*.{po,pot,mo}]
binary = true

[*.md]
trim_trailing_whitespace = false
88 changes: 88 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# +-------------------------------------------------------------------------+
# | Copyright (C) 2004-2026 The Cacti Group |
# | |
# | This program is free software; you can redistribute it and/or |
# | modify it under the terms of the GNU General Public License |
# | as published by the Free Software Foundation; either version 2 |
# | of the License, or (at your option) any later version. |
# | |
# | This program is distributed in the hope that it will be useful, |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# | GNU General Public License for more details. |
# +-------------------------------------------------------------------------+
# | Cacti: The Complete RRDtool-based Graphing Solution |
# +-------------------------------------------------------------------------+
# | This code is designed, written, and maintained by the Cacti Group. See |
# | about.php and/or the AUTHORS file for specific developer information. |
# +-------------------------------------------------------------------------+
# | http://www.cacti.net/ |
# +-------------------------------------------------------------------------+

name: Code Quality

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
code-quality:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']

name: PHP ${{ matrix.php }} Code Quality

steps:
- name: Checkout audit Plugin
uses: actions/checkout@v4

- name: Install PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, mbstring, dom, xml, json, sockets
coverage: none
ini-values: "memory_limit=512M"

- name: Check PHP version
run: php -v

- name: Validate composer.json
run: composer validate --strict

- name: Install Composer Dependencies
run: composer install --prefer-dist --no-progress --ignore-platform-reqs

- name: Check PHP Syntax
run: |
if find . -name '*.php' -not -path './vendor/*' -not -path './locales/*' -exec php -l {} \; 2>&1 | grep -iv 'no syntax errors detected'; then
echo "Syntax errors found!"
exit 1
fi

- name: Run PHP-CS-Fixer (dry-run)
run: vendor/bin/php-cs-fixer fix --dry-run --diff --config=./.php-cs-fixer.php --allow-unsupported-php-version=yes

- name: Run PHPStan
run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress

- name: Run Pest Tests
if: ${{ matrix.php != '8.1' }}
run: vendor/bin/pest tests/Security --display-warnings

- name: Run Audit Security Helper Tests
run: |
php tests/security_functions_test.php
php tests/controller_security_test.php
php tests/syslog_queue_test.php
timeout 60 php tests/syslog_functions_test.php
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@


locales/po/*.mo

# Composer
vendor/

# PHPStan
phpstan.cache/
.phpstan-baseline.neon.local

# PHP-CS-Fixer
.php-cs-fixer.cache

# Pest / PHPUnit
.phpunit.result.cache
227 changes: 227 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
<?php

/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2026 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDtool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/

/*
* PHP-CS-Fixer configuration for the Cacti Audit Plugin.
*
* The ruleset is copied verbatim from the Cacti core repository
* (develop branch .php-cs-fixer.php) so the plugin follows the exact
* same coding standard as Cacti core. Only the Finder excludes have
* been adapted to the plugin's directory layout.
*/

$finder = PhpCsFixer\Finder::create()
->exclude('locales')
->exclude('js')
->exclude('.github')
->exclude('openspec')
->exclude('vendor')
->in(__DIR__);

$config = new PhpCsFixer\Config();
$config
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setIndent("\t")
->setLineEnding("\n")
->setRules(array(
'header_comment' => false,
'comment_to_phpdoc' => true,
'phpdoc_align' => true,
'list_syntax' => ['syntax' => 'short'],
'array_syntax' => ['syntax' => 'short'],
'trim_array_spaces' => false,
'no_whitespace_before_comma_in_array' => true,
'whitespace_after_comma_in_array' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_whitespace_in_blank_line' => true,
'no_trailing_whitespace' => true,
'normalize_index_brace' => true,
'no_mixed_echo_print' => ['use' => 'print'],
'no_spaces_after_function_name' => true,
'braces' => [
'position_after_functions_and_oop_constructs' => 'same',
'position_after_control_structures' => 'same',
'allow_single_line_closure' => true
],
'braces_position' => [
'anonymous_classes_opening_brace' => 'same_line',
'anonymous_functions_opening_brace' => 'same_line',
'classes_opening_brace' => 'same_line',
'functions_opening_brace' => 'same_line'
],
'single_blank_line_at_eof' => true,
'method_chaining_indentation' => true,
'indentation_type' => true,
'constant_case' => true,
'lowercase_keywords' => true,
'line_ending' => true,
'magic_constant_casing' => true,
'native_function_casing' => true,
'elseif' => true,
'include' => false,
'no_alternative_syntax' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_braces' => true,
'no_useless_else' => false,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => null,
'always_move_variable' => false
],
'declare_equal_normalize' => ['space' => 'single'],
'dir_constant' => true,
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'abstract',
'as',
'attribute',
'break',
'case',
'catch',
'class',
'clone',
'const',
'const_import',
'continue',
'do',
'echo',
'else',
'elseif',
'extends',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'global',
'goto',
'if',
'implements',
'instanceof',
'insteadof',
'interface',
'match',
'named_argument',
'new',
'open_tag_with_echo',
'php_open',
'print',
'private',
'protected',
'public',
'return',
'static',
'throw',
'trait',
'try',
'use',
'use_lambda',
'use_trait',
'var',
'while',
'yield',
'yield_from'
]
],
'concat_space' => ['spacing' => 'one'],
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'switch_continue_to_break' => true,
'logical_operators' => true,
'function_declaration' => ['closure_function_spacing' => 'one'],
'spaces_inside_parentheses' => true,
'binary_operator_spaces' => [
'operators' => [
'+=' => 'align_single_space',
'===' => 'align_single_space_minimal',
'=' => 'align_single_space',
'|' => 'single_space',
'=>' => 'align',
'!=' => 'align'
]
],
'not_operator_with_space' => false,
'no_spaces_around_offset' => ['positions' => ['outside', 'inside']],
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'full_opening_tag' => false,
'linebreak_after_opening_tag' => false,
'phpdoc_add_missing_param_annotation' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break',
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'switch',
'throw',
'use'
]
],
'no_empty_statement' => true,
'multiline_whitespace_before_semicolons' => true,
'no_singleline_whitespace_before_semicolons' => true,
'semicolon_after_instruction' => false,
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
'blank_line_before_statement' => [
'statements' => [
'continue',
'break',
'declare',
'do',
'for',
'foreach',
'goto',
'if',
'return',
'switch',
'throw',
'try',
'while',
'yield',
'yield_from'
]
],
'explicit_string_variable' => false,
'single_quote' => true,
'string_line_ending' => true,
'strict_param' => true,
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
'single_line_comment_spacing' => true,
'single_line_comment_style' => true,
'multiline_comment_opening_closing' => true
))
->setFinder($finder);

return $config;
Loading
Loading