test: add Pest v1 security test infrastructure - #93
Open
somethingwithproof wants to merge 4 commits into
Open
somethingwithproof wants to merge 4 commits into
somethingwithproof wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Pest v1-based security testing scaffold for the Cacti MikroTik plugin to validate setup structure, discourage raw DB helper usage, and enforce PHP 7.4 compatibility constraints.
Changes:
- Introduces Pest bootstrap/configuration and a dev Composer setup to run the test suite.
- Adds security-oriented source-scan tests for
setup.phpstructure and prepared-statement helper usage. - Adds source-scan checks to prevent use of select PHP 8-only APIs/syntax in key plugin files.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| composer.json | Adds Pest v1 as a dev dependency and wires test bootstrap via autoload-dev. |
| tests/Pest.php | Pest entry/config that loads the test bootstrap. |
| tests/bootstrap.php | Provides Cacti framework stubs/constants so tests can run in isolation. |
| tests/Security/SetupStructureTest.php | Verifies expected plugin hook functions and version array keys exist in setup.php. |
| tests/Security/PreparedStatementConsistencyTest.php | Scans key plugin files to forbid raw db_execute/db_fetch_* usage. |
| tests/Security/Php74CompatibilityTest.php | Scans for select PHP 8-only APIs/syntax (e.g., str_contains, nullsafe operator). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
somethingwithproof
marked this pull request as draft
April 11, 2026 00:10
Member
Author
|
Converted to draft to serialize the stack in this repo. Blocked by #90; will un-draft after that merges to avoid cross-PR merge conflicts. |
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>
…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>
somethingwithproof
force-pushed
the
test/add-security-test-infrastructure
branch
from
July 14, 2026 10:46
65d0e1b to
1cf06e7
Compare
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
xmacan
approved these changes
Sep 15, 2026
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
Test plan
composer install && vendor/bin/pestpasses