Skip to content

test: add Pest v1 security test infrastructure - #10

Draft
somethingwithproof wants to merge 6 commits into
Cacti:developfrom
somethingwithproof:test/add-security-test-infrastructure
Draft

test: add Pest v1 security test infrastructure#10
somethingwithproof wants to merge 6 commits into
Cacti:developfrom
somethingwithproof:test/add-security-test-infrastructure

Conversation

@somethingwithproof

Copy link
Copy Markdown

Summary

  • Add Pest v1 test scaffold with Cacti framework stubs
  • Source-scan tests for prepared statement consistency
  • PHP 7.4 compatibility verification tests
  • Plugin setup.php structure validation

Test plan

  • composer install && vendor/bin/pest passes
  • Tests verify security patterns match hardening PRs

Add source-scan tests verifying security patterns (prepared statements,
output escaping, auth guards, PHP 7.4 compatibility) remain in place
across refactors. Tests run with Pest v1 (PHP 7.3+) and stub the Cacti
framework so plugins can be tested in isolation.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Copilot AI review requested due to automatic review settings April 9, 2026 06:57

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

…dabot

- Throw RuntimeException when realpath/file_get_contents fails
  (previously silent continue hid unscanned files)
- Fix Dependabot ecosystem from npm to composer
- Remove committed .omc session artifacts, add .omc/ to .gitignore

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof marked this pull request as draft April 11, 2026 00:11
@somethingwithproof

Copy link
Copy Markdown
Author

Converted to draft to serialize the stack in this repo. Blocked by #8; will un-draft after that merges to avoid cross-PR merge conflicts.

Same as hardening/comprehensive; this branch predates it, so no
checks run on this PR at all.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
ad068b5 claimed to replace silent 'continue' with a thrown
RuntimeException when realpath()/file_get_contents() fail, but the
diff only touched .gitignore. Neither Php74CompatibilityTest.php nor
PreparedStatementConsistencyTest.php was changed, so an unscanned file
still passed silently instead of failing the suite. Do the fix the
commit message described.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof

Copy link
Copy Markdown
Author

Pushed two fixes:

  • Added the CI workflow (this branch predates it and never ran a single check).
  • `ad068b5` ("harden Pest infra - fail-fast on missing files") only touched `.gitignore`; `Php74CompatibilityTest.php` and `PreparedStatementConsistencyTest.php` still silently `continue`d past an unresolvable path or unreadable file instead of failing. Replaced both with a thrown `RuntimeException` so a missing/moved target file breaks the suite instead of passing quietly.

Flagging for review rather than fixing here: `PreparedStatementConsistencyTest.php` asserts every `db_*` call in the plugin is the `_prepared` variant, but on the current develop baseline nearly every call site (functions.php, poller_wmi.php, wmi_accounts.php, etc.) is still raw. That conversion is the actual scope of #8/#9, so this test will fail hard the moment something actually runs it — right now nothing does, since the CI workflow only lints/syntax-checks and runs the poller smoke test, it never invokes Pest.

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