Skip to content

hardening: prepared statements, PHP 7.4 idioms, and security fixes - #8

Open
somethingwithproof wants to merge 7 commits into
Cacti:developfrom
somethingwithproof:hardening/comprehensive
Open

hardening: prepared statements, PHP 7.4 idioms, and security fixes#8
somethingwithproof wants to merge 7 commits into
Cacti:developfrom
somethingwithproof:hardening/comprehensive

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Consolidated hardening: migrate to prepared statements, null coalescing operators, PHP 7.4 str_starts_with replacement.

Copilot AI review requested due to automatic review settings April 9, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the WMI plugin by reducing SQL injection risk via prepared statements and tightening command/credential handling in the Linux WMI execution path.

Changes:

  • Converted several SQL calls to prepared statements (db_fetch_*_prepared, db_execute_prepared).
  • Hardened shell command construction by escaping the WMI hostname before execution.
  • Changed stored credential encoding from PHP serialize() to base64(JSON), while retaining legacy decode support.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
script/wmi-script.php Fetch WMI query metadata using a prepared statement.
poller_wmi.php Purge queries use prepared deletes keyed by host_id.
linux_wmi.php Escape hostname for shell execution; update password encode/decode format with legacy support.
functions.php Prepared query for data_input_fields lookup in XML export generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread linux_wmi.php Outdated
Comment thread linux_wmi.php Outdated
Comment thread linux_wmi.php Outdated
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
… equivalents

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof force-pushed the hardening/comprehensive branch from 9497065 to dbd67bc Compare July 14, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants