hardening: migrate flowview process/version lookups to prepared - #248
Draft
somethingwithproof wants to merge 7 commits into
Draft
hardening: migrate flowview process/version lookups to prepared#248somethingwithproof wants to merge 7 commits into
somethingwithproof wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates FlowView plugin code to replace raw SQL string queries with prepared statements, and adds a lightweight regression test to detect reintroduction of those raw lookups.
Changes:
- Converted plugin version lookup in
setup.phptodb_fetch_cell_prepared()with a bound placeholder. - Converted FlowView master process PID lookups in
setup.phpandflowview_devices.phptodb_fetch_cell_prepared()with bound placeholders. - Added a PHP test script that scans source files to assert prepared-statement usage and absence of specific raw lookups.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_prepared_statements.php | Adds string-based regression checks to enforce prepared-statement usage for specific queries. |
| setup.php | Replaces raw db_fetch_cell() lookups with db_fetch_cell_prepared() for plugin version and PID retrieval. |
| flowview_devices.php | Replaces raw PID lookups with prepared statements for save/restart service paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Member
Author
|
Incorporated follow-up review feedback in |
somethingwithproof
marked this pull request as draft
March 20, 2026 10:00
Member
|
Looks like after the last merge, you should update your branch @somethingwithproof |
Add targeted tests for prepared statement migration, output escaping, auth guard presence, CSRF token validation, redirect safety, and PHP 7.4 compatibility. Tests use source-scan patterns that verify security invariants without requiring the Cacti database. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
somethingwithproof
force-pushed
the
fix/prepared-lookups-247
branch
from
July 29, 2026 05:35
2ffba84 to
acea08d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements issue #247 by migrating selected raw process/version lookups to prepared database helpers.
Changes
flowview_devices.phpsave_device()todb_fetch_cell_prepared()restart_services()todb_fetch_cell_prepared()setup.phpplugin_flowview_check_config()todb_fetch_cell_prepared()flowview_global_settings_update()todb_fetch_cell_prepared()tests/test_prepared_statements.phpValidation
php -l flowview_devices.phpphp -l setup.phpphp -l tests/test_prepared_statements.phpphp tests/test_prepared_statements.phpIssue
Closes #247