hardening: migrate quicktree SQL helpers to prepared variants - #12
hardening: migrate quicktree SQL helpers to prepared variants#12somethingwithproof wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the plugin_quicktree plugin by migrating selected SQL read helpers from raw query helpers to prepared-statement variants, and adds a small regression script to verify the migration patterns remain in place.
Changes:
- Convert
quicktree.phpgraph-tree list and max-sequence lookups todb_fetch_*_prepared. - Convert
setup.phpplugin version lookup todb_fetch_cell_prepared. - Add
tests/test_prepared_statements.phpto statically verify prepared-helper usage and absence of raw helper calls in the touched files.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
quicktree.php |
Replaces specific raw read queries with prepared helper equivalents. |
setup.php |
Uses prepared helper for plugin version lookup during upgrade checks. |
tests/test_prepared_statements.php |
Adds regression checks (via regex) to enforce prepared-helper usage in updated files. |
💡 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.
|
Incorporated follow-up review feedback in |
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>
|
Converted to draft to serialize the stack in this repo. Blocked by #10; will un-draft after that merges to avoid cross-PR merge conflicts. |
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Summary
plugin_quicktreeSQL helper reads to prepared variantsquicktree.phpto prepared helperssetup.phpto prepared helperTests
php -l quicktree.phpphp -l setup.phpphp -l tests/test_prepared_statements.phpphp tests/test_prepared_statements.phpCloses #11